Reputation: 640
In my sample project I have a datagrid that gets populated with values from the server. The datagrid row can be selected using the mouse initially. But in my code, this row selection should happen only after an "activate" button is clicked. How should I do this?
I tried the IsEnabled
property for datagrid, but that causes the entire datagrid to be inactive
(the text and headers are grayed out).
Please help me out.
Upvotes: 0
Views: 1016
Reputation: 3146
I guess that should work:
datagrid.SelectionChanged += (obj, args) =>
Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() =>
datagrid.UnselectAll()));
An alternative is modifying DataGrid styles. Anyway, you need to also consider your "activated" value.
Upvotes: 1