Hi,
I set IsOnCellActiveEditingEnabled="True" to make sure that when I fill in data in a XamWebGrid and use the Tab key to navigate to other cells, that the selected active cell is automatically in edit mode. (as illustrated below)
However, another requirement for my grid is that is must be enabled to select multiple cells using shift key, ctrl key or just using the mousebutton. It is logical (I guess) to set IsOnCellActiveEditingEnabled="False" to enable this (as Illustrated below). If I leave the setting to "True", the first cell is in edit mode and I can't select other cells without leaving edit mode.
Is there a possibility to combine the "True"/"False" flag and what would be the best way/events to achieve such functionality ?
Thanks,
Nicolas
Hi Nicolas,
If you're trying to keep the tab functionality for rows only, then perhaps you can just set the AllowEditing property to Row as opposed to Cell. Then, tab will work for editing on that row, and you won't need to have the IsOnCellActiveEditingEnabled property turned on.
However, if you're on the last cell in a row and you hit tab, then the row will exit edit mode, and the first cell in the next row won't enter edit mode.
-SteveZ
If I change the AllowEditing mode to Row I get the following behaviour:
When hitting Enter, the row doesn't leave edit mode and the cells in the row get a border around each value. (see screenhots before and after hitting enter)
I found probably what is causing my issue. On CellControlAttached Event I check a condition and set two possible styles on the cell. If I don't to this I don't get the behaviour above.
These are my two syle definitions. Is there something wrong in it ?
<Style x:Key="NetCapacityNegativeStyle" TargetType="igGrid:CellControl"> <Setter Property="Background" Value="Red"> </Setter> <Setter Property="Foreground" Value="White" /> </Style> <Style x:Key="NormalStyle" TargetType="igGrid:CellControl"> </Style> <Style TargetType="igGrid:CellControl" x:Key="BorderStyle"> <Setter Property="BorderThickness" Value="0,3,1,0"></Setter> </Style>
You were right.
Enter key was indeed working. This was a mistake from my side.
I solved the problem by setting
grvLiveData.CellControlAttached -=
new EventHandler<CellControlAttachedEventArgs>(grvLiveData_CellControlAttached);
in RowEnteringEditMode
and by re-setting
grvLiveData.CellControlAttached +=
in RowExitedEditMode
The Enter key should definitely exit edit mode for you.
You should avoid using the CellControlAttached event for switch the style for editing though, as it won't be raised when you enter edit mode.
Do you have a sample that reproduces the row not exiting edit mode with the enter key?
I cried out victory too soon.
It seems whenever I set a custom cell style (for the whole row) on the CellControlAttached Event, the Editing mode gets weird behaviour. (as you can see in an earlier screenshot of mine). The enter key doesn't update the row in that case.
Am I missing something in my custom style declaration ?
<Style TargetType="igGrid:CellControl" x:Key="BorderStyle"> <Setter Property="BorderThickness" Value="0,3,1,0"></Setter> </Style>
I should use this forum more as a whiteboard to solve my problems :-) because I found a solution.
I do a check on
CellControlAttachedEventArgs
ccA = (CellControlAttachedEventArgs)e;
if (ccA.Cell.IsEditing == false)
{
}
If the cell is in Editing mode, I reset the style for the whole row to "NormalStyle"