Question

I have a telerik RadGrid with the checkbox column

               <telerik:GridViewDataColumn  Header="Subject">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding Path=IsSelected, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                        telerik:StyleManager.Theme="Office_Black"/>
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>

when the user check any row in the checkbox column I want to get the checked row.If we use the MouseLeftButtonDown event how do we the get the row or as am binding IsSelected to the viewModel is there any way to get the row from the viewmodel ?

Was it helpful?

Solution

           <telerik:GridViewDataColumn  Header="Subject">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <CheckBox IsChecked="{Binding  Path=IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Checked="CheckBox_Checked"/>  
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>  


    private void CheckBox_Checked(object sender, RoutedEventArgs e)
    {
        var parent = (sender as CheckBox).ParentOfType<GridViewRow>();
       var Item = parent.Item as ClassItem;
      // ClassItem name of class itemsource to the grid
    } 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top