This is a migrated thread and some comments may be shown as answers.

Wpf Gridview

0 Answers 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mic
Top achievements
Rank 1
Mic asked on 14 Sep 2012, 02:57 PM
Hello,
I want to select gridview row data by clicking on check box column. But when I check checkbox, selectedItem property return null  value and I have to select a row and then check checkbox. How can I solve this problem.
Thanks in advance,
 <telerik:RadGridView.Columns>                           
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}" Header="Id"   readOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name"  IsReadOnly="True"/>
                            <telerik:GridViewDataColumn Header="Select " >
                                <telerik:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox Name="checkbox1" IsChecked="{Binding Select,Mode=TwoWay}" HorizontalAlignment="Center"   checked="WordCheckBox_Checked" />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellTemplate>
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>

private void WordCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            try
            {                               
                MyWord word_obj = new MyWord();
                word_obj = dg.SelectedItem as MyWord;
                if (word_obj != null)
                {
                    wordList_obj.Add(word_obj);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Mic
Top achievements
Rank 1
Share this question
or