This question is locked. New answers and comments are not allowed.
In my project I use RadPropertyGrid. I can't set custom editors in xaml because I don't know properties of PropertyGrid.Item in design mode.
I defined PropertyDefinition and set EditorTemplate in run time.
<DataTemplate x:Name="CustomComboBox"> <ComboBox telerik:AutoBindBehavior.UpdateBindingOnElementLoaded="SelectedValue" SelectionMode="Single" Loaded="ComboBox_Loaded"/></DataTemplate>I have dynamically set some properties of Editors in Loaded() event (for example ItemsSource for ComboBox).
I use PropertyGridField.AutoGeneratedPath to define witch editor is loading.
private void ComboBox_Loaded(object sender, RoutedEventArgs e){ string propertyName = ((PropertyDefinition)((PropertyGridField)((ComboBox)sender).Parent).DataContext).AutoGeneratedPath; //creating itemsList... ((ComboBox)sender).ItemsSource = itemsList; ((ComboBox)sender).DisplayMemberPath = "DisplayName"; ((ComboBox)sender).SelectedValuePath = "Code";}In EditMode="Default" it works fine.
If I set EditMode to Single this solution will not work.
In Loaded() event sender.Parent = null.