Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4970
Hit Ins/Del key not captured when click on cell inside the Xamgrid
posted

Try to use XamGrid with following xaml:  

<ig:XamGrid  AutoGenerateColumns="false"
    ItemsSource="{Binding ....}"
    DeleteKeyAction="DeleteRowOfActiveCell"
    CellClicked="XamGrid_CellClicked_1"             
    KeyUp="XamGrid_KeyUp_1">
    <ig:XamGrid.SummaryRowSettings>
        <ig:SummaryRowSettings AllowSummaryRow="Bottom" SummaryScope="ColumnLayout" SummaryExecution="PriorToFilteringAndPaging"  />
    </ig:XamGrid.SummaryRowSettings>
    <ig:XamGrid.SortingSettings>
        <ig:SortingSettings FirstSortDirection="Descending" AllowMultipleColumnSorting="True" />
    </ig:XamGrid.SortingSettings>
    <ig:XamGrid.Columns>

    ..........

    </ig:XamGrid.Columns>
</ig:XamGrid>   

then in code behind, try to capture the key hit to customize the insert and delete action:

private void XamGrid_KeyUp_1(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Insert)
    {
      //......
    }


    if (e.Key == Key.Delete)
    {
      //......
    }
}

Then run the app, I have problem as below:

Ins/Del key can't be captured when click on any cell in the grid. Only when Click on the header of the grid, then hit the keyboard, Keyup event handler XamGrid_KeyUp_1 will be captured.

What I want is:

When click on any cell in the grid(select the row), then hit Del key to delete the row from grid.

At any time when XamGrid got the cursor(either by click Header or click on any cell inside the grid), hit Ins key will insert a row in the grid.

How to resolve this problem?

Parents Reply Children
No Data