Enter in edit mode by typping characters

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,


4 Replies 1 reply marked as answer

BT Balamurugan Thirumalaikumar Syncfusion Team July 27, 2021 02:37 PM UTC

Hi Daniel, 
 
Thank you for interesting in Syncfusion products. 
 
We could understand your requirement. We are validating the reported scenario at our end. will update you the proper details on July 29,2021. We appreciate your patience till then. 
 
Regards 
Balamurugan.Thirumalaikumar 



BT Balamurugan Thirumalaikumar Syncfusion Team July 29, 2021 03:21 PM UTC

Hi Daniel, 
 
Thank you for your patience. 
 
We have checked your query at our end. In order to achieve the reported scenario we suggest you to set the CustomGridCellTemplateRenderer and handle the key action in ShouldGridTryToHandleKeyDown event. You can refer the following sample for your reference. 
 
 
Please let us know if you would require any other assistance on this. we will be happy to assist you 
 
Regards 
Balamurugan.Thirumalaikumar 



DG Daniel Garcia July 30, 2021 08:19 AM UTC

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,


Marked as answer

BT Balamurugan Thirumalaikumar Syncfusion Team August 2, 2021 06:59 AM UTC

Hi Daniel, 
 
Thank you for your update. 
 
We are very glad to have the provided solution using ShouldGridTryToHandleKeyDown event resolved your query. please get back to us at anytime if you need any other assistance. As always we will be happy to assist you. 
 
Balamurugan Thirumalaikumar  
 


Loader.
Up arrow icon