I have several GridViews on my interface and then on one it has a ChildTableDefinition. I am trying to have the TAB key insert a row if pressed on the end of the last line on each GridView. I have followed the instructions and created the KeyboardCommandProvider that overrides the ProvideCommandsForKey method. I have then wired up the KeyboardCommandProvider in the code behind
myGrid1.KeyboardCommandProvider = new Commands.TabKeyCommandProvider(myGrid1);
however the definition for my Child Table is done via a DataTemplate
<telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition />
</telerik:RadGridView.ChildTableDefinitions>
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerik:RadGridView ItemsSource="{Binding custom_identifier}"
x:Name="ChildGrid1"
ShowGroupPanel="False"
AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding label}"
Header="Custom Identifier"
IsSortable="True"
IsFilterable="False" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
Now as this child Grid is defined in a template, I can not reference it using the x:Name of "ChildGrid1" in the code behind. So how do I attach the custom Command Provider to this grid?
Also - is there an MVVM way of doing this as doing it in Code Behind is not ideal ??
Any suggestions welcome