当前位置: 首页>>代码示例>>C#>>正文


C# ScatterViewItem.ApplyTemplate方法代码示例

本文整理汇总了C#中ScatterViewItem.ApplyTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# ScatterViewItem.ApplyTemplate方法的具体用法?C# ScatterViewItem.ApplyTemplate怎么用?C# ScatterViewItem.ApplyTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScatterViewItem的用法示例。


在下文中一共展示了ScatterViewItem.ApplyTemplate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: timer_Tick

        void timer_Tick(object sender, EventArgs e)
        {
            this.ParentJanitor.ScreenSaverRuns = true;
            this.Dispatcher.Invoke(
            System.Windows.Threading.DispatcherPriority.Normal,
            (DummyDelegate)
            delegate
            {
            ScatterViewItem svi = new ScatterViewItem();
            //Viewbox svi = new Viewbox();
            Viewbox vb = new Viewbox();
            Label label = new Label();

            label.Content = d[rand.Next(0, d.Count)];
            label.Foreground = new SolidColorBrush(Colors.White);
            label.Width = 200;
            label.Height = 50;
            label.FontSize = 20;
            label.FontWeight = FontWeights.ExtraLight;

            label.HorizontalContentAlignment = HorizontalAlignment.Center;
            vb.Child = label;
            svi.Content = vb;
            vb.IsEnabled = false;
            svi.Orientation = 0;
            svi.Opacity = 0;
            svi.Width = 4000;
            svi.Height = 1000;

            BlurEffect blur = new BlurEffect();
            blur.Radius = 50;
            blur.RenderingBias = RenderingBias.Performance;
            blur.KernelType = KernelType.Gaussian;
            svi.Effect = blur;

            svi.ApplyTemplate();
            svi.Background = new SolidColorBrush(Colors.Transparent);
            svi.ShowsActivationEffects = false;
            Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;
            ssc = svi.Template.FindName("shadow", svi) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
            ssc.Visibility = Visibility.Hidden;
            svi.BorderBrush = Brushes.Transparent;
            svi.IsHitTestVisible = false;
            svi.ClipToBounds = false;

            DoubleAnimation blurAnim = new DoubleAnimation(20, 10, new Duration(TimeSpan.FromSeconds(4)), FillBehavior.Stop);
            blurAnim.AutoReverse = true;

            blur.BeginAnimation(BlurEffect.RadiusProperty, blurAnim, HandoffBehavior.Compose);

            DoubleAnimation WidthAnim = new DoubleAnimation(200, 4000, new Duration(TimeSpan.FromSeconds(8)), FillBehavior.Stop);
            WidthAnim.Completed += new EventHandler(WidthAnim_Completed);

            svi.BeginAnimation(ScatterViewItem.WidthProperty, WidthAnim, HandoffBehavior.Compose);

            DoubleAnimation HeightAnim = new DoubleAnimation(50, 1000, new Duration(TimeSpan.FromSeconds(8)), FillBehavior.Stop);

            svi.BeginAnimation(ScatterViewItem.HeightProperty, HeightAnim, HandoffBehavior.Compose);

            DoubleAnimation OpacityAnim = new DoubleAnimation(0, .5, new Duration(TimeSpan.FromSeconds(4)), FillBehavior.Stop);
            OpacityAnim.AutoReverse = true;

            svi.BeginAnimation(ScatterViewItem.OpacityProperty, OpacityAnim, HandoffBehavior.Compose);

            //sb.Children.Add(blurAnim);
            //sb.Children.Add(WidthAnim);
            //sb.Children.Add(HeightAnim);
            //sb.Children.Add(OpacityAnim);
            //Storyboard.SetTarget(blurAnim, blur);
            //Storyboard.SetTarget(WidthAnim, svi);
            //Storyboard.SetTarget(HeightAnim, svi);
            //Storyboard.SetTarget(OpacityAnim, svi);
            //Storyboard.SetTargetProperty(blurAnim, new PropertyPath(BlurEffect.RadiusProperty));
            //Storyboard.SetTargetProperty(WidthAnim, new PropertyPath(ScatterViewItem.WidthProperty));
            //Storyboard.SetTargetProperty(HeightAnim, new PropertyPath(ScatterViewItem.HeightProperty));
            //Storyboard.SetTargetProperty(OpacityAnim, new PropertyPath(ScatterViewItem.OpacityProperty));
            //sb.Begin();
            MainSV.Items.Add(svi);

            });
        }
开发者ID:pittruff,项目名称:myStik,代码行数:81,代码来源:Screensaver.xaml.cs

示例2: NewPointerAddedEvent

        public void NewPointerAddedEvent(RemotePointer addedPointer, string assignedColorCode)
        {
            this.Dispatcher.Invoke(new Action(() =>
            {
                try
                {
                    ScatterViewItem pointerContainer = new ScatterViewItem();
                    pointerContainer.ApplyTemplate();
                    RemotePointerUI pointerUI = new RemotePointerUI();
                    pointerUI.PointerID = addedPointer.Id;
                    pointerUI.setPointerColor(assignedColorCode);
                    pointerUI.Width = pointerUI.Height = 50;
                    pointerContainer.Width = pointerUI.Width;
                    pointerContainer.Height = pointerUI.Height;
                    //disable surrounding shadow
                    pointerContainer.Background = null;
                    pointerContainer.BorderThickness = new Thickness(0);
                    pointerContainer.ShowsActivationEffects = false;
                    //SurfaceShadowChrome ssc = pointerContainer.Template.FindName("shadow", pointerContainer) as SurfaceShadowChrome;
                    //ssc.Visibility = Visibility.Collapsed;
                    //add to the canvas and adjust location
                    pointerContainer.Content = pointerUI;
                    pointerContainer.Tag = addedPointer;
                    sv_RemotePointerCanvas.Items.Add(pointerContainer);
                    int X = (int)(addedPointer.X * canvasesContainer.Width);
                    int Y = (int)(addedPointer.Y * canvasesContainer.Height);
                    pointerContainer.Center = new System.Windows.Point(X, Y);
                    sv_RemotePointerCanvas.UpdateLayout();

                    Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_RemotePointerAdded(addedPointer));
                }
                catch (Exception ex)
                {
                    Utilities.UtilitiesLib.LogError(ex);
                }
            }));
        }
开发者ID:lekd,项目名称:Metaplan,代码行数:37,代码来源:BrainstormCanvas.xaml.cs

示例3: previewPage

        public void previewPage()
        {
            main.ActiveSessionManager.SaveCurrentPage(main.PageInkCanvas.Strokes);

            preparePreview(main.Container);

            SurfaceInkCanvas preview = this.previewCanvas;
            preview.Strokes.Clear();
            ScatterView previewContainer = this.previewContainer;
            CanvasItem.IsTopmostOnActivation = false;

            preview.Strokes.Add(main.PageInkCanvas.Strokes);
            try
            {
                this.BackgroundImage.Source = new BitmapImage(new Uri(EnvironmentFolder.getImagesFolder() + main.ActiveSessionManager.CurrentPage.BackgroundImageSource));
                preview.Background = new SolidColorBrush(Colors.Transparent);
            }
            catch (Exception ex)
            {
                preview.Background = new SolidColorBrush(Colors.White);
            }

            // String content = String.Empty;
            preview.Height = main.PageInkCanvas.ActualHeight;
            preview.Width = main.PageInkCanvas.ActualWidth;
            this.currentPageIndex = main.ActiveSessionManager.CurrentPage.UniqueId;

            //it will add all the containers and just let visible the container of the current page
            foreach (ASGPage previewPage in main.ActiveSessionManager.CurrentProject.PageDictionary.Values)
            {

                foreach (var item in previewPage.PrototypeElementDictionary.Values)
                {
                    ScatterViewItem svi = new ScatterViewItem();

                    if (item.BackgroundImage != "")
                    {
                        BitmapImage src = new BitmapImage();
                        src.BeginInit();
                        src.UriSource = new Uri(EnvironmentFolder.getImagesFolder() + item.BackgroundImage, UriKind.Absolute);
                        src.EndInit();
                        svi.Content = new Image() { Source = src };
                    }
                    else
                        svi.Content = new Rectangle() { Fill = new SolidColorBrush(Colors.Transparent) };

                    svi.Width = item.Width;
                    svi.Height = item.Height;
                    svi.Tag = item;
                    svi.ContainerStaysActive = false;
                    svi.IsTopmostOnActivation = true;

                    foreach (var gesture in item.GestureTargetPageMap)
                    {
                        AttachEvent(gesture, svi);
                    }
                    previewContainer.Items.Add(svi);
                    svi.Orientation = item.Orientation;
                    svi.Center = item.Center;

                    svi.CanMove = false;
                    svi.CanRotate = false;
                    svi.CanScale = false;

                    if (svi.ApplyTemplate())
                    {
                        svi.Background = new SolidColorBrush(Colors.Transparent);
                        svi.BorderBrush = System.Windows.Media.Brushes.Transparent;
                        Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;
                        svi.ShowsActivationEffects = false;
                        ssc = svi.Template.FindName("shadow", svi) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
                        ssc.Visibility = Visibility.Hidden;
                    }

                    if (previewPage.UniqueId == main.ActiveSessionManager.CurrentPage.UniqueId)
                    {
                        svi.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        svi.Visibility = Visibility.Hidden;
                    }

                }
            }
        }
开发者ID:tuliosouza,项目名称:ASG,代码行数:86,代码来源:PreviewWindow.xaml.cs

示例4: RemoveScatterViewItemEffects

        public ScatterViewItem RemoveScatterViewItemEffects(ScatterViewItem svi)
        {
            Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;

            svi.ShowsActivationEffects = false;
            svi.ApplyTemplate();
            ssc = svi.Template.FindName("shadow", svi) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
            ssc.Visibility = Visibility.Hidden;
            svi.ApplyTemplate();

            return svi;
        }
开发者ID:tuliosouza,项目名称:ASG,代码行数:12,代码来源:DrawingCanvasHelper.cs


注:本文中的ScatterViewItem.ApplyTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。