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

[Solved] Issue with CheckBox cell

1 Answer 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Carolyn
Top achievements
Rank 1
Carolyn asked on 27 Sep 2009, 06:26 PM
I'm having an issue with a CheckBox in a RadGridView.  Using SL3 and RadSilverlight Q3 Beta controls.  When the loaded event is called for the CheckBox, the parent cell's value is null.  Am I doing something wrong here, or is this a legitimate issue?  Sample XAML and C# code below:


<telGrid:RadGridView x:Name="gvRoles"  
            AutoGenerateColumns="False"  
            Background="White" 
            CanUserFreezeColumns="False" 
            CanUserReorderColumns="False" 
            ColumnsWidthMode="Auto"  
            Grid.Row="0" 
            GridLinesVisibility="None" 
            IsFilteringAllowed="False" 
            IsReadOnly="true" 
            Margin="10 10 10 10" 
            MultipleSelect="True" 
            RowIndicatorVisibility="Collapsed" 
            ShowGroupPanel="False" 
        > 
            <telGrid:RadGridView.Columns> 
                <telGrid:GridViewDataColumn HeaderText=""
                    <telGrid:GridViewDataColumn.CellTemplate> 
                        <DataTemplate> 
                            <CheckBox x:Name="cbRole" HorizontalAlignment="Center" IsChecked="False" Loaded="cbRole_Loaded" /> 
                        </DataTemplate> 
                    </telGrid:GridViewDataColumn.CellTemplate> 
                </telGrid:GridViewDataColumn> 
            </telGrid:RadGridView.Columns> 
        </telGrid:RadGridView> 

private void cbRole_Loaded(object sender, RoutedEventArgs e) 
        { 
            CheckBox checkBox = sender as CheckBox; 
            GridViewCell parentCell = checkBox.Parent as GridViewCell; 
        } 


1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 30 Sep 2009, 06:56 AM
Hi Joe Dattilo,

You can try to use one of our extension methods to obtain the parent cell:

private void cbRole_Loaded(object sender, System.Windows.RoutedEventArgs e)  
{  
    CheckBox box = sender as CheckBox;  
    var parentCell = box.ParentOfType<GridViewCell>();  


Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Carolyn
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or