Hi,
I am using a GridTemplateColumn in a spefific column and my need is to be in edition mode when I type any chararacter (A-Z, 0-9) without using F2 or click. It works with GridTextColumn or GridNumericColumn.
this is my template:
<syncfusion:GridTemplateColumn UpdateTrigger="PropertyChanged" MappingName="Classitemcode" x:Uid="TextClass" AllowEditing="True">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Margin="10,2,2,2" Text="{Binding Classitemcode}"/>
</Grid>
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
<syncfusion:GridTemplateColumn.EditTemplate>
<DataTemplate>
<Grid>
<sfInput:SfTextBoxExt
AutoCompleteMode="Suggest"
SuggestionMode="Contains"
ShowSuggestionsOnFocus="False"
SearchItemPath="No"
AutoCompleteSource="{Binding ClassItems}"
syncfusion:FocusManagerHelper.FocusedElement="True"
PreviewKeyDown="SfTextBoxExt_PreviewKeyDown"
Text="{Binding Classitemcode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<sfInput:SfTextBoxExt.AutoCompleteItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Code}"/>
<TextBlock Text="{Binding Description}" Opacity="0.5" FontSize="12"/>
</StackPanel>
</DataTemplate>
</sfInput:SfTextBoxExt.AutoCompleteItemTemplate>
</sfInput:SfTextBoxExt>
</Grid>
</DataTemplate>
</syncfusion:GridTemplateColumn.EditTemplate>
</syncfusion:GridTemplateColumn>
How Can I resolve this?
Regards,
Hi,
Thank you for your help. I had to adapt the event ShouldGridTryToHandleKeyDown. When I pressed a number (0 for example), the text was "NumberPad0" instead of "0". The adapted code below:
string key = "";
if (e.Key >= VirtualKey.Number0 && e.Key <= VirtualKey.Number9)
key = (e.Key - VirtualKey.Number0).ToString();
else if (e.Key >= VirtualKey.NumberPad0 && e.Key <= VirtualKey.NumberPad9)
key = (e.Key - VirtualKey.NumberPad0).ToString();
Regards,