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


C# ScatterViewItem.AddHandler方法代码示例

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


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

示例1: Add

 private void Add(ScatterViewItem element)
 {
     DocumentContainer.SetDockState(element, DockStates.Floating);
     element.AddHandler(UIElement.ManipulationCompletedEvent, new EventHandler<ManipulationCompletedEventArgs>(element_ManipulationDelta), true);
     element.PreviewTouchMove += new EventHandler<TouchEventArgs>(element_PreviewTouchMove);
     ((ScatterViewItem)element).Template = (ControlTemplate)element.FindResource("Floating");
     element.Orientation = 0;
     element.CanRotate = false;
     this.view.Items.Add(element);
 }
开发者ID:madebysoren,项目名称:NooSphere,代码行数:10,代码来源:DocumentContainer.xaml.cs

示例2: ItemProxy_PreviewTouchDown

        /// <summary>
        /// Handles the PreviewContactDown event of the ItemProxy control.
        /// If a ItemProxy can't move, block the contact so that a manipulation doesn't begin. Otherwise, create an SVI from the proxy.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Input.TouchEventArgs"/> instance containing the event data.</param>
        private void ItemProxy_PreviewTouchDown(object sender, TouchEventArgs e)
        {
            ItemProxy proxy = sender as ItemProxy;
            RiverItemState state = GetState(proxy);

            if (!proxy.CanMove || state.IsAnimatingToContactOrientation || state.IsAnimatingToRemovedSize || state.IsAnimatingBackToRiver)
            {
                e.Handled = true;
                return;
            }

            if ((e.OriginalSource as FrameworkElement).FindVisualParent<Button>() != null)
            {
                // Ignore if an admin button is pressed.
                return;
            }

            // Create the SVI and set its position and orientation.
            ScatterViewItem svi = new ScatterViewItem();
            _scatterView.Items.Add(svi);
            state.Svi = svi;
            svi.Style = state.ItemStyle;
            svi.MinHeight = proxy.MinHeight;
            svi.MinWidth = proxy.MinWidth;
            svi.Center = proxy.Center;
            svi.Orientation = proxy.Orientation;
            svi.CanScale = false;
            svi.CanRotate = false;

            // Set the SVI size.
            bool isPortrait = state.RowSpan > state.ColumnSpan;
            double itemWidth = state.ColumnSpan * GridCellSize.Width;
            double itemHeight = state.RowSpan * GridCellSize.Height;
            itemWidth += Plane.GetPlaneFrontPadding(svi).Left + Plane.GetPlaneFrontPadding(svi).Right;
            itemHeight += Plane.GetPlaneFrontPadding(svi).Top + Plane.GetPlaneFrontPadding(svi).Bottom;
            svi.Width = isPortrait ? itemHeight : itemWidth;
            svi.Height = isPortrait ? itemWidth : itemHeight;

            // Hook events.
            svi.ContainerActivated += ScatterViewItem_Activated;
            svi.ContainerManipulationDelta += ScatterViewItem_ScatterManipulationDelta;
            svi.ContainerDeactivated += ScatterViewItem_Deactivated;
            svi.ContainerManipulationCompleted += ScatterViewItem_ScatterManipulationCompleted;
            TouchChangedEvents.AddAreAnyTouchesCapturedWithinChangedHandler(svi, new RoutedEventHandler(ScatterViewItem_AreAnyTouchesCapturedWithinChanged));
            svi.AddHandler(RiverItemBase.FlipRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_FlipRequested));
            svi.AddHandler(RiverItemBase.CloseRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_CloseRequested));

            svi.Unloaded += (a, b) =>
            {
                // Unhook events on unload.
                svi.ContainerActivated -= ScatterViewItem_Activated;
                svi.ContainerManipulationDelta -= ScatterViewItem_ScatterManipulationDelta;
                svi.ContainerDeactivated -= ScatterViewItem_Deactivated;
                svi.ContainerManipulationCompleted -= ScatterViewItem_ScatterManipulationCompleted;
                TouchChangedEvents.RemoveAreAnyTouchesCapturedWithinChangedHandler(svi, new RoutedEventHandler(ScatterViewItem_AreAnyTouchesCapturedWithinChanged));
                svi.RemoveHandler(RiverItemBase.FlipRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_FlipRequested));
                svi.RemoveHandler(RiverItemBase.CloseRequestedEvent, new RiverItemBase.SourceRoutedEventHandler(ScatterViewItem_CloseRequested));
            };

            svi.Loaded += (a, b) =>
            {
                // Populate with data when loaded.
                RiverItemBase proxyItem = proxy.FindVisualChild<RiverItemBase>();
                RiverItemBase sviItem = svi.FindVisualChild<RiverItemBase>();
                sviItem.RenderData(state, proxyItem.DataContext);
                proxy.Visibility = Visibility.Hidden;
            };

            // Steal the touch from the proxy.
            svi.UpdateLayout();
            svi.CaptureTouch(e.TouchDevice);
        }
开发者ID:thuyhk,项目名称:SocialStream,代码行数:78,代码来源:River.xaml.cs

示例3: hHomesContent

        /// <summary>
        ///     Content to be displayed on the holiday homes page
        /// </summary>
        /// <returns>A stackpanel with the holiday home content</returns>
        private StackPanel hHomesContent()
        {
            StackPanel contentStackPanel = new StackPanel();
            //Create a scatter view for the holiday home pictures
            scatter = new ScatterView();
            scatter.Height = 500;
            scatter.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));

            //Create a scrollviewer for the details about the homes
            hhscroll = new SurfaceScrollViewer();
            hhscroll.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            hhscroll.Height = 300;
            hhscroll.Background = new SolidColorBrush(Util.contentBgColor);

            hhscroll.ScrollChanged += hhscroll_ScrollChanged;

            //Create a prompt to show the user that they can move/zoom the pictures
            TextBlock prompt = Util.TextBlockFactory();
            prompt.TextAlignment = TextAlignment.Center;
            prompt.Inlines.Add(new Run("Click on the images below to see information or use two fingers to zoom\n"));

            contentStackPanel.Children.Add(prompt);
            contentStackPanel.Children.Add(scatter);
            contentStackPanel.Children.Add(hhscroll);

            //Don't allow horizontal scrolling
            hhscroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            hhscroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            //Create new scatterview item for the arrowwtown home
            arrowtown = new ScatterViewItem();
            arrowtown.Content = new PoloroidControl("images/FamilySupport/arrowtown.jpg", "Arrowtown",
                (Color) ColorConverter.ConvertFromString("#ffffffff"));
            (arrowtown.Content as PoloroidControl).removeBorder();
            arrowtown.Orientation = 0;
            arrowtown.Height = 200;
            arrowtown.Width = 300;
            arrowtown.AddHandler(MouseUpEvent, new MouseButtonEventHandler(arrowtown_MouseUp), true);
            scatter.Items.Add(arrowtown);

            //Create new scatterview item for the taupo home
            taupo = new ScatterViewItem();
            taupo.Content = new PoloroidControl("images/FamilySupport/taupo.jpg", "Taupo",
                (Color) ColorConverter.ConvertFromString("#ffffffff"));
            (taupo.Content as PoloroidControl).removeBorder();
            taupo.Orientation = 0;
            taupo.Height = 200;
            taupo.Width = 300;
            taupo.AddHandler(MouseUpEvent, new MouseButtonEventHandler(taupo_MouseUp), true);
            scatter.Items.Add(taupo);

            //Create new scatterview item for the hawkes bay home
            hawkesbay = new ScatterViewItem();
            hawkesbay.Content = new PoloroidControl("images/FamilySupport/hawkesBay.jpg", "Hawkes Bay",
                (Color) ColorConverter.ConvertFromString("#00ffffff"));
            (hawkesbay.Content as PoloroidControl).removeBorder();
            hawkesbay.Orientation = 0;
            hawkesbay.Height = 200;
            hawkesbay.Width = 300;
            hawkesbay.AddHandler(MouseUpEvent, new MouseButtonEventHandler(hawkesBay_MouseUp), true);
            scatter.Items.Add(hawkesbay);

            //set the content to initially be hawkes bay content
            hawkesBay_MouseUp(null, null);
            return contentStackPanel;
        }
开发者ID:raouldc,项目名称:OptiDev,代码行数:70,代码来源:fsHomeControl.xaml.cs


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