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
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?
-SteveZ
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"
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>