C1NumericBox UpDown Click handler inside a Template Column

Posted by: mayur.purandare on 29 March 2023, 5:41 am EST

    • Post Options:
    • Link

    Posted 29 March 2023, 5:41 am EST

    In a C1DataGrid, we have C1NumericBox inside the DataGridTemplateColumn.

    a) We have UpDownKeys for this, and Is there any event handler upon each of these button clicks.

    OR

    b) Is there any way we can get the row details, when the C1NumericBox column element is selected.

  • Posted 30 March 2023, 2:11 pm EST

    Hi Mayur,

    a. Since you have set C1NumericBox inside the cell template of the DataGridTemplateColumn, then you can handle the increment/decrement button clicks by handling C1NumericBox’s ValueChanged event.

    b. In order to get the row details on clicking the C1NumericBox column element, you will first need to set the datagrid’s RowDetailsVisibilityMode to VisibleWhenSelected as shown in the following line of code:

     datagrid.RowDetailsVisibilityMode = C1.WPF.DataGrid.DataGridRowDetailsVisibilityMode.VisibleWhenSelected;

    and then handle the datagrid’s PreviewMouseLeftButtonDown event as shown below:

    private void datagrid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
    	var cell = datagrid.GetCellFromPoint(e.GetPosition(this));
    	if(cell.Column.Index == 1)
    	{
    		datagrid.SelectedItem = cell.Row.DataItem;
    	}
    }
    

    Kindly refer to the attached sample for implementation. See NumericColumnDataGrid_Mod.zip

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels