Donate

Access Datagrid Row In WPF Through Index

Hi All,

This is just a repost from this site: Accessing DataGridRow on how to get or access the WPF Datagrid row through index.
  DataGridRow dgr = (DataGridRow)dataGrid1.ItemContainerGenerator.ContainerFromIndex(nRowIndex);  
  if (dgr == null) // row might be invisible (top / bottom). So, scroll into the view and get it  
  {  
    dataGrid1.UpdateLayout();  
    dataGrid1.ScrollIntoView(dataGrid1.Items[nRowIndex]);  
    dgr = (DataGridRow)dataGrid1.ItemContainerGenerator.ContainerFromIndex(nRowIndex);  
  } 
Thanks for the original contributor, this helped me a lot.
Access WPF Datagrid Row Through Index

Comments

Post a Comment

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.

Invalid nested tag div found, expected closing tag input