ComponentOne DataGrid for WPF and Silverlight
DataGrid for WPF and Silverlight Overview / DataGrid Features / Keyboard and Mouse Navigation / Custom Keyboard Navigation
In This Topic
    Custom Keyboard Navigation
    In This Topic

    You can add your own custom navigation to the C1DataGrid control. Custom keyboard navigation enables you to control how users interact with the grid. For example, you can prevent users from navigating to read-only columns or cells with null values. In a hierarchical grid, you could set up navigation between parent and child grids. To add custom keyboard navigation you would need to handle the KeyDown event and then add code to override the default navigation with your customized navigation.

    Adding the KeyDown Event Handler

    Complete the following steps to add the KeyDown event handler:

    1. Switch to Code view and add an event handler for the KeyDown event, for example:
    2. Switch to Source view and add the event handler to instances of the C1DataGrid control, for example:

    <c1:C1DataGrid x:Name="c1DataGrid1" AutoGenerateColumns="True" KeyDown="c1DataGrid1_KeyDown"></c1:C1DataGrid>

    You can now add code to the KeyDown event handler to customize the default navigation. For an example, you can take a look at the hierarchical grid example (C1_MDSL_RowDetail) in the ControlExplorer sample.