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

Unable to access combo box in GridViewComboBoxColumn

0 Answers 17 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ha asked on 30 Nov 2011, 06:13 PM

I use RadGridView in a xaml. The gridview has a column with checkbox, and another column with combobox (I use GridViewComboBoxColumn for this column). What I want to do is when the check box is checked, the combobox of the same row will be disabled (or readonly). In the Checked event of the checkbox, I try to get the combobox, but it always returns null. Could you tell me how to get to the combo box and disable it.

Here is part of my xaml:
<telerik:RadGridView ....>
        <telerik:GridViewDataColumn Header="Manager" UniqueName="RoleId">
                    <CheckBox IsChecked="{Binding Path=RoleId, Converter={StaticResource RoleIdBooleanConverter}, Mode=TwoWay}"
                              x:Name="ManagerCheckBox" Checked="ManagerCheckBox_Checked"/>

         <telerik:GridViewComboBoxColumn Header ="X Level" UniqueName="XLevel"  DataMemberBinding="{Binding Path=XLevel, 
              ItemsSourceBinding="{Binding Source={StaticResource XLevelResource}}"  DisplayMemberPath="XInfo"      
              SelectedValueMemberPath="XItem" >

Here is my Checked event:
private void ManagerCheckBox_Checked(object sender, RoutedEventArgs e) {
     CheckBox cb = sender as CheckBox;
     if ( cb.IsChecked.HasValue && cb.IsChecked.Value ) {    
        var gvr = cb.ParentOfType<GridViewRow>(); // I get the row here
        var comboB = gvr.ChildrenOfType<GridViewComboBoxColumn>().Where(b=>b.UniqueName=="XLevel").FirstOrDefault();
        // comboB is always null here.
Thank you,

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question