Hi Team ,
I am new to WPF , we are using RadGridView to load data from View Model in WPF by using C# .
if selected a row and data grid refreshed or load with new items(rows) then selected row position is moving either up or down to row .
here vertical scroll bar position changed .
reproduce steps
1. Select any of the row from the grid.
2. Wait for the Lobby updates to happen and new tables get added to the grid
Expected:
- The select state should be anchored to its grid position, updates should happen above and below the selected row (the selected row will not move)
XAML :
<telerik:RadGridView x:Name="PokerX_CashGames_RadGridView_LobbyGrid" ItemsSource="{Binding CashGamesCollection, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedTableItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Loaded="OnDataGridLoaded" Unloaded="OnDataGridUnloaded"
AutomationProperties.AutomationId="PokerX_CashGames_RadGridView_LobbyGrid">
<i:Interaction.Behaviors>
xaml.cs
private void OnDataGridDataUpdated(object datagridUpdateEventArgs){
if (datagridUpdateEventArgs is DataGridUpdateEvent eventArgs && this.PokerX_CashGames_RadGridView_LobbyGrid != null)
{
double scrollOffset = (eventArgs.CurrentIndexOfSelectedRecord - eventArgs.PreviousIndexOfSelectedRecord) * this.PokerX_CashGames_RadGridView_LobbyGrid.RowHeight;
GridViewScrollViewer scrollViewer = this.PokerX_CashGames_RadGridView_LobbyGrid.ChildrenOfType<GridViewScrollViewer>().First();
if (scrollViewer != null)
{
double verticalOffset = scrollViewer.VerticalOffset;
scrollViewer.ScrollToVerticalOffset(verticalOffset + scrollOffset);
}
}
}
Please help me how can i fix this .
Hi Team
any update on this , please this is an priory issue to our aplication
pls help as soon as possible