Let me start by saying that I am fairly new to WPF development so it's likely the problem is just something I'm doing wrong. In my application I have several elements which can be selected and we would like to have their (custom) properties displayed in a RadPropertyGrid in a docked pane. The way I have set it up is that each element has a PropertyPane user control which contains a RadPropertyGrid, and when the element is clicked the element's PropertyPane should be set as the content of the RadPane in the MainWindow. From what I can tell the PropertyPane seems to have a valid RadPropertyGrid when it is being set as the content, but when the content is displayed the RadPropertyGrid is empty.
The section in the MainWindow where the PropertyPane is inserted:
The user control which contains the RadPropertyGrid:
And the code for the element class which should update the RadPropertyGrid:
The section in the MainWindow where the PropertyPane is inserted:
<!-- Properties Pane --><telerik:RadSplitContainer InitialPosition="DockedRight"> <telerik:RadPaneGroup> <telerik:RadPane Name="propertyPane" Header="Properties" CanUserClose="False"> </telerik:RadPane> </telerik:RadPaneGroup></telerik:RadSplitContainer>The user control which contains the RadPropertyGrid:
<UserControl x:Class="App.PropertiesPane" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <telerik:RadPropertyGrid AutoGeneratePropertyDefinitions="False" Name="PropertyGrid" /> </Grid></UserControl>And the code for the element class which should update the RadPropertyGrid:
public class DiagramControlTextBox : TextBox{ public PropertiesPane PropPane; public Telerik.Windows.Controls.RadPropertyGrid DCProperties; public int Size; public int Weight; public void updatePropertiesPane(object sender, RoutedEventArgs e) { App.Current.MainWindow.propertyPane.Content = this.PropPane; } public void initializePropertiesPane() { this.PropPane = new PropertiesPane(); this.DCProperties = new Telerik.Windows.Controls.RadPropertyGrid(); Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinition sizeProperty = new Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinition() { DisplayName = "Size", Binding = new Binding { Source = this.Size } }; Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinition weightProperty = new Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinition() { DisplayName = "Weight", Binding = new Binding { Source = this.Weight } }; this.DCProperties.AutoGeneratePropertyDefinitions = false; this.DCProperties.SearchBoxVisibility = System.Windows.Visibility.Hidden; this.DCProperties.DescriptionPanelVisibility = System.Windows.Visibility.Hidden; this.DCProperties.PropertyDefinitions.Add(sizeProperty); this.DCProperties.PropertyDefinitions.Add(weightProperty); this.DCProperties.Item = this; this.PropPane.PropertyGrid = this.DCProperties; } }