コード例 #1
0
        public void SetBottomViewRow(object sender)
        {
            DataGrid dg = null;

            dg = sender as DataGrid;
            if (dg.SelectedItem == null)
            {
                return;
            }
            var scroll = DataGridNavigation.FindVisualChild <ScrollViewer> ((DependencyObject)dg);

            if (scroll == null)
            {
                return;
            }
            scroll.CanContentScroll = true;
            double d       = scroll.VerticalOffset;
            int    rounded = Convert.ToInt32(d);

            if (dg == this.BankGrid)
            {
                //				Console . WriteLine ( $"\n######## Flags . TopVisibleDetGridRow == {scroll . VerticalOffset}\n######## TopVisible = { Flags . BottomVisibleBankGridRow}\n######## NEW Value = { scroll . VerticalOffset}" );
                Flags.BottomVisibleBankGridRow = ( double )rounded;
            }
            else if (dg == this.CustomerGrid)
            {
                //				Console . WriteLine ( $"\n######## Flags . TopVisibleDetGridRow == {scroll . VerticalOffset}\n######## TopVisible = { Flags . BottomVisibleCustGridRow}\n######## NEW Value = { scroll . VerticalOffset}" );
                Flags.BottomVisibleCustGridRow = ( double )rounded;
            }
            else if (dg == this.DetailsGrid)
            {
                //				Console . WriteLine ( $"\n######## Flags . TopVisibleDetGridRow == {scroll . VerticalOffset}\n######## TopVisible = { Flags . BottomVisibleDetGridRow}\n######## NEW Value = { scroll . VerticalOffset}" );
                Flags.BottomVisibleDetGridRow = ( double )rounded;
            }
        }
コード例 #2
0
        private void DetailsGrid_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            DataGrid dg = null;

            dg = sender as DataGrid;
            var scroll = DataGridNavigation.FindVisualChild <ScrollViewer> ((DependencyObject)dg);

            scroll.CanContentScroll = true;
            SetScrollVariables(sender);
            this.CustomerGrid.ScrollIntoView(this.DetailsGrid.SelectedIndex);
            this.BankGrid.ScrollIntoView(this.DetailsGrid.SelectedIndex);
            this.DetailsGrid.ScrollIntoView(this.DetailsGrid.SelectedIndex);
        }
コード例 #3
0
        public void SetViewPort(object sender)
        {
            DataGrid dg = null;

            dg = sender as DataGrid;
            if (dg.SelectedItem == null)
            {
                return;
            }
            var scroll = DataGridNavigation.FindVisualChild <ScrollViewer> ((DependencyObject)dg);

            if (scroll == null)
            {
                return;
            }
            scroll.CanContentScroll = true;
            Flags.ViewPortHeight    = scroll.ViewportHeight;
        }