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
790
Right click to select a record in extended selection mode, with already few records selected in it
posted

Hi

I would like to select a record upon mouse right click. The data grid is setup for extended selection mode and I'm able to select record on right click if my data grid doesn't have any preselected rows. However, it behaves differently when already one or more records selected in it. Please help me with this issue. Sample code provided below:

xaml

<igDataPresenter:XamDataGrid.Resources>
<Style TargetType="{x:Type igDataPresenter:DataRecordPresenter}">
<EventSetter Event="MouseRightButtonDown" Handler="XamDataGrid_OnMouseRightButtonDown"/>
</Style>
</igDataPresenter:XamDataGrid.Resources>

xaml.cs

private void XamDataGrid_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
var viewModel = DataContext as StructureViewModel;
if (viewModel != null)
{

var dataRecordPresenter = sender as DataRecordPresenter;
if (dataRecordPresenter != null && dataRecordPresenter.Record != null && dataGrid != null)
{
dataRecordPresenter.Record.IsSelected = true;
}
}
}

Thanks

Parents Reply Children
No Data