Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cell focus in a data grid
Message
From
06/01/2012 06:03:54
 
 
To
04/01/2012 16:27:34
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 4.0
Application:
Desktop
Miscellaneous
Thread ID:
01532185
Message ID:
01532275
Views:
23
>I have a data grid bound to any number of rows, most of the time just one, but when the grid receives focus, I really need the first cell of the first row to recieve editable focus. Any ideas how to do this?

Something like this in the GotFocus() might work:
DG.CurrentCell = new DataGridCellInfo(DG.Items[0], DG.Columns[0]);
DG.UnselectAllCells();
DG.SelectedCells.Add(DG.CurrentCell);
DG.BeginEdit();
But I've a feeling the user would find it a bit disconcerting. The OnFocus only fires when they click on an actual cell and that may be the cell they actually want to edit? Also if there's a scrollbar and the user uses it then the OnFocus fires when they move back to the Grid
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform