Code-Behind value of Property Grid Checkbox

2 posts, 0 answers
  1. Eric
    Eric avatar
    17 posts
    Member since:
    Aug 2011

    Posted 07 Sep 2011 Link to this post

    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.
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 09 Sep 2011 Link to this post

    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 >>

  3. DevCraft banner
Back to Top