public ListViewBaseSelectionExtention(ListViewBase View, Rectangle RectangleInCanvas)
        {
            this.View = View ?? throw new ArgumentNullException(nameof(View), "Argument could not be null");
            this.RectangleInCanvas = RectangleInCanvas ?? throw new ArgumentNullException(nameof(RectangleInCanvas), "Argument could not be null");

            this.View.AddHandler(UIElement.PointerPressedEvent, PointerPressedHandler         = new PointerEventHandler(View_RectangleDrawStart), true);
            this.View.AddHandler(UIElement.PointerReleasedEvent, PointerReleasedHandler       = new PointerEventHandler(View_RectangleDrawEnd), true);
            this.View.AddHandler(UIElement.PointerCaptureLostEvent, PointerCaptureLostHandler = new PointerEventHandler(View_RectangleDrawEnd), true);
            this.View.AddHandler(UIElement.PointerCanceledEvent, PointerCanceledHandler       = new PointerEventHandler(View_RectangleDrawEnd), true);
            this.View.AddHandler(UIElement.PointerMovedEvent, PointerMovedHandler             = new PointerEventHandler(View_PointerMoved), true);

            if (View.IsLoaded)
            {
                InnerScrollView = View.FindChildOfType <ScrollViewer>();
                InnerScrollBar  = View.FindChildOfType <ScrollBar>();

                if (InnerScrollBar != null)
                {
                    InnerScrollBar.Scroll += InnerScrollBar_Scroll;
                }
            }
            else
            {
                this.View.Loaded += View_Loaded;
            }
        }
        private void View_Loaded(object sender, RoutedEventArgs e)
        {
            View.Loaded -= View_Loaded;

            InnerScrollView = View.FindChildOfType <ScrollViewer>();
            InnerScrollBar  = View.FindChildOfType <ScrollBar>();

            if (InnerScrollBar != null)
            {
                InnerScrollBar.Scroll += InnerScrollBar_Scroll;
            }
        }
Exemplo n.º 3
0
        public ListViewBaseSelectionExtention(ListViewBase View, Rectangle RectangleInCanvas)
        {
            this.View = View ?? throw new ArgumentNullException(nameof(View), "Argument could not be null");
            this.RectangleInCanvas = RectangleInCanvas ?? throw new ArgumentNullException(nameof(RectangleInCanvas), "Argument could not be null");

            if (RectangleInCanvas.Parent is not Canvas)
            {
                throw new ArgumentException("Reactangle must be placed in Canvas", nameof(RectangleInCanvas));
            }

            this.View.PointerPressed     += View_RectangleDrawStart;
            this.View.PointerReleased    += View_RectangleDrawEnd;
            this.View.PointerCaptureLost += View_RectangleDrawEnd;
            this.View.PointerCanceled    += View_RectangleDrawEnd;

            if (View.IsLoaded)
            {
                InnerScrollView = View.FindChildOfType <ScrollViewer>();
            }
            else
            {
                this.View.Loaded += View_Loaded;
            }
        }
Exemplo n.º 4
0
        private void View_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            View.Loaded -= View_Loaded;

            InnerScrollView = View.FindChildOfType <ScrollViewer>();
        }