how to disable row selection for particular cells in telerik raddatagrid UWP

时间:2019-01-28 05:55:09

标签: uwp telerik telerik-grid

I have a UWP Telerik RadDatagrid with a checkbox on the first column of each row which allows the user to mark the row item for later processing. The datagrid has a selection changed event which redirects to another page based on the selected row item. I don't want this selection changed event to work if user only selected the checkbox in the first column. But currently it works if i click on any cell and there is no way to disable it cell wise.

The only way to make it work is set a global boolean in the checkbox checked event and checking that value to disable the redirection statement in the selected event handler.

This seems as a workaround and doesn't seem right. Is there any other way by which i can disable row selection cell wise.

<gridControl:RadDataGrid x:Name="itemsGrid" AutoGenerateColumns="False" UserEditMode="None" 
UserGroupMode="Disabled" UserColumnReorderMode="None" UserFilterMode="Disabled" ItemsSource="{x:Bind ViewModel.Items, Mode=OneWay}" 
                                 SelectedItem="{x:Bind ViewModel.Item, Mode=TwoWay, Converter={StaticResource GenericConverter}}" 
                                 SelectionChanged="itemsGrid_SelectionChanged">
            <gridControl:RadDataGrid.Columns>
                <gridControl:DataGridTemplateColumn Header="Select">
                    <gridControl:DataGridTemplateColumn.CellContentTemplate>
                        <DataTemplate>
                            <StackPanel x:Name="stackItem" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <CheckBox x:Name="chkItem" Checked="chkItem_Checked"></CheckBox>
                            </StackPanel>
                        </DataTemplate>
                    </gridControl:DataGridTemplateColumn.CellContentTemplate>
                </gridControl:DataGridTemplateColumn>
                <gridControl:DataGridTextColumn PropertyName="ItemCode" Header="Code" />

0 个答案:

没有答案