Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF DataGrid moving or navigating to next record works but datagrid is static and does not move as I click on next button!!!

$
0
0

Hello..\

I have a datagrid bound to a collection of data. My code works, as I click on the button "Next", the selection moves to the next row, however, as I keep on going down, the datagrid just stays there and does not move down as it should, hence, when is the end of the viewable rows in the datagrid, it just keep on going down but I cant see the rows.... In order for the user to go to the last row also works because I used a scrollviewer and just the scroll to home or scroll to end.

Here is part of my code:

 
       private void btnNavigation_Click(object sender, RoutedEventArgs e)
        {
            Button currentButton = sender as Button;
            var border = VisualTreeHelper.GetChild(clienteDataGrid, 0) as Decorator;
            var scroll = border.Child as ScrollViewer;
            switch (currentButton.Tag.ToString())
            {
                case "Previous":
                    source.MoveCurrentToPrevious();
                    break;
                case "Next":
                    source.MoveCurrentToNext();
                     break;
                case "First":
                    source.MoveCurrentToFirst();
                    scroll.ScrollToHome();
                    break;
                case "Last":
                    source.MoveCurrentToLast();
                    scroll.ScrollToEnd();
                    break;
            }
        }

I hope someone can guide me....

Thanks


Guisselle


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>