Silverlight / WPF - Highlighting and getting reference to a row in datagrid in WPF

Asked By Mitu N on 12-Jun-15 04:45 PM

I'm new to WPF.I've a UI screen on which am binding and showing a datagrid in the load event. When users clicks on a row,I need to highlight it with blue color and then get a handle to the selected row. How do I achieve this please?

Robbe Morris replied to Mitu N on 06-Jun-15 05:26 PM
We have a ton of XAML based articles on this site.  This one on binding selected item in a ListView is similar to what you are after.  The core important thing to pick up on binding, is that doesn't just have to be about the "data".  You can have your data classes inherit some basic custom UI oriented classes and certain properties.  If you bind these property values to your UI control, then simply changing the proper value on the data object fires all the redrawing updates to the UI.

https://www.nullskull.com/a/10476811/xaml-listviewgridview-to-select-multiple-items-based-on-search-criteria.aspx

https://www.nullskull.com/articlelist.aspx?topicid=56&page=1