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

Code-Behind value of Property Grid Checkbox

1 Answer 188 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 07 Sep 2011, 09:16 PM
I am creating an unBound Property Grid.
Each property will be a CheckBox.
But when i try to load or Save data to the Properties, i do not have access to them in Code-Behind.
The Checkbox does not show in Intellisense nor could i figure out how to loop through the PropertyDefinitions to get the values

How do i Set/Load Values to the CheckBox in Code Behind

Here is sample of my xaml.
        <telerik:RadPropertyGrid x:Name="pgRoles"  AutoGeneratePropertyDefinitions="False"
                                 SortAndGroupButtonsVisibility="Collapsed" DescriptionPanelVisibility="Visible" LabelColumnWidth="180">
            <telerik:RadPropertyGrid.PropertyDefinitions>
                <telerik:PropertyDefinition DisplayName="Release Docs" GroupName="General" Description="User can Release Closing Documents">
                    <telerik:PropertyDefinition.EditorTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="chReleaseDocs" />
                        </DataTemplate>
                    </telerik:PropertyDefinition.EditorTemplate>
                </telerik:PropertyDefinition>
            </telerik:RadPropertyGrid.PropertyDefinitions>
        </telerik:RadPropertyGrid>    

Thank you for your assistance.

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 09 Sep 2011, 07:41 AM
Hi Eric,

PropertyDeifinitions are not visual objects and they are not loaded in the visual tree. However editors you apply are set as Content of their respective PropertyGridFields, so that you can access the CheckBox like this:

radPropertyGrid.ChildrenOfType<PropertyGridField>().First().Content;

Kind regards,
Ivan Ivanov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
PropertyGrid
Asked by
Eric
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or