Class AutoGeneratingPropertyGridItemEventArgs
Provides data to the AutoGeneratingPropertyGridItem event of the PropertyGrid control.
Inheritance
Namespace: Syncfusion.Windows.PropertyGrid
Assembly: Syncfusion.PropertyGrid.Wpf.dll
Syntax
public class AutoGeneratingPropertyGridItemEventArgs : CancelEventArgs
Constructors
AutoGeneratingPropertyGridItemEventArgs()
Declaration
public AutoGeneratingPropertyGridItemEventArgs()
Properties
Category
Gets or sets the name of the category for the property item based on the Category name proeprty items will be grouped.
Declaration
public string Category { get; set; }
Property Value
Type |
---|
System.String |
Description
Gets or sets a desciption of the property item
Declaration
public string Description { get; set; }
Property Value
Type |
---|
System.String |
DescriptionTemplate
Gets or sets the template used to display the description of SelectedItem.
Declaration
public DataTemplate DescriptionTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | The template that defines the appearance of the description Panel. |
Remarks
DataContext of DescriptionTemplate is PropertyItem. PropertyItem has Name, Description and other useful properties, that can be bounded to the DescriptionTemplate. DescriptionTemplate can be defined in Autogenerating event, PropertyGridItem and PropertyGrid. AutoGeneratingPropertyGridItemEventArgs.DescriptionTemplate takes the highest precedence, PropertyGridItem.DescriptionTemplate takes second precedence, and PropertyGrid.DescriptionTemplate takes the last precedence.
Examples
The following example shows how to define a Description template for property item in PropertyGrid control.
<Grid x:Name="grid">
<Grid.Resources>
<DataTemplate x:Key="template1">
<StackPanel>
<TextBlock Text = "{Binding Name}"
FontSize="16"
Foreground="Red"
TextWrapping="Wrap"/>
<TextBlock Text = "{Binding Description}"
FontSize="14"
Foreground="Green"
TextWrapping="Wrap"/>
</StackPanel>
</DataTemplate>
</Grid.Resources>
<syncfusion:PropertyGrid x:Name="propertyGrid"
AutoGeneratingPropertyGridItem = "OnAutoGeneratingPropertyGridItem"
DescriptionPanelVisibility="Visible">
<syncfusion:PropertyGrid.SelectedObject>
<local:Employee></local:Employee>
</syncfusion:PropertyGrid.SelectedObject>
</syncfusion:PropertyGrid>
</Grid>
private void OnAutoGeneratingPropertyGridItem(object sender, AutoGeneratingPropertyGridItemEventArgs e)
{
if (e.DisplayName == "Name" || e.DisplayName == "DOB")
{
e.DescriptionTemplate = grid.TryFindResource("template1") as DataTemplate;
}
}
public class Employee
{
[Description("Name of the employee")]
public string Name { get; set; }
[Description("ID of the employee")]
public string ID { get; set; }
[Description("Birth date of the employee")]
public DateTime DOB { get; set; }
[Description("Age of the employee")]
public int Age { get; set; }
public Employee()
{
Name = "John";
ID = "381";
DOB = new DateTime(1995, 12, 24);
Age = 26;
}
}
DisplayName
Gets or sets a display name to the property item.
Declaration
public string DisplayName { get; set; }
Property Value
Type |
---|
System.String |
ExpandMode
Gets or sets whether to populate nested properties of PropertyItem or not.
Declaration
public PropertyExpandModes ExpandMode { get; set; }
Property Value
Type |
---|
PropertyExpandModes |
Remarks
When NestedMode is set, nested properties of PropertyItem will be populated. When FlatMode is set, nested properties of PropertyItem will not be populated.
Order
Gets or sets a value to arrange the property item into the PropertyCollection when the SortDirection is null. Based on the value specifed in the Order, property item will get arrange.
Declaration
public Nullable<int> Order { get; set; }
Property Value
Type |
---|
System.Nullable<System.Int32> |
OriginalSource
Gets the PropertyItem that is being added to the property collection of PropertyGrid.
Declaration
public object OriginalSource { get; }
Property Value
Type |
---|
System.Object |
ReadOnly
Gets or sets a value indicating whether the property item is ready only or not.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type |
---|
System.Boolean |