Firstly, add the property gird with AutoGeneratePropertyDefinitions set to true and the AutoGeneratingPropertyDefinition event handler:
<telerik:RadPropertyGrid AutoGeneratePropertyDefinitions="True" IsGrouped="True" AutoExpandGroups="True" Item="{Binding Selected}" AutoGeneratingPropertyDefinition="OnPropertyGridPropertyDefinition"/>
In the code behind:
private void OnPropertyGridPropertyDefinition(object sender, AutoGeneratingPropertyDefinitionEventArgs e) { var attributes = e.PropertyDefinition.PropertyDescriptor.Attributes; foreach (Attribute attribute in attributes) { if (attribute is DisplayAttribute) { e.Cancel = false; return; } } e.Cancel = true; }
In the view model:
public class MyViewModel : NodeViewModelBase { Display(Name = "Name", GroupName = "Documentation", Description = "An optional name for this function block.", Order = 0)] public string Name { get; set; } : }
No comments:
Post a Comment