New to Telerik UI for WPF? Download free 30-day trial

Set Properties on the RadPropertyGrid inside the CollectionEditor

Environment

Product Version 2018.2.620
Product RadPropertyGrid for WPF

Description

How to set properties on the RadPropertyGrid inside the CollectionEditor.

Solution

  1. Handle the Loaded event of the parent RadRropertyGrid.

        private void RadPropertyGrid_Loaded(object sender, RoutedEventArgs e) 
        { 
            var editorPicker = rpg.ChildrenOfType<CollectionEditorPicker>().First(); 
            var collectionEditor = editorPicker.CollectionEditor; 
            collectionEditor.Loaded += CollectionEditor_Loaded; 
        } 
    
        Private Sub RadPropertyGrid_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 
            Dim editorPicker = rpg.ChildrenOfType(Of CollectionEditorPicker)().First() 
            Dim collectionEditor = editorPicker.CollectionEditor 
            collectionEditor.Loaded += CollectionEditor_Loaded 
        End Sub 
    
  2. Handle the Loaded event of the CollectionEditor.

        private void CollectionEditor_Loaded(object sender, RoutedEventArgs e) 
        { 
            var collectionEditor = sender as CollectionEditor; 
            var propertyGrid = collectionEditor.ChildrenOfType<RadPropertyGrid>().First(); 
                propertyGrid.LabelColumnWidth = new GridLength(50); 
                // set any other properties 
        } 
    
        Private Sub CollectionEditor_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 
            Dim collectionEditor = TryCast(sender, CollectionEditor) 
            Dim propertyGrid = collectionEditor.ChildrenOfType(Of RadPropertyGrid)().First() 
        propertyGrid.LabelColumnWidth = New GridLength(50) 
        ' set any other properties 
        End Sub 
    

See Also

In this article