Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cell focus in a data grid
Message
De
06/01/2012 11:53:04
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
06/01/2012 06:03:54
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 4.0
Application:
Desktop
Divers
Thread ID:
01532185
Message ID:
01532325
Vues:
25
>>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

Good points Viv, I suspect I don't want the focus moved around every time that event fires. Maybe only when the expander gets focus, a tab could move to the first cell of the first row. After that, the tab inside the grid would work normally.
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform