Getting Started with WinUI PropertyGrid
This guide provides the information you need to start using the Telerik UI for WinUI PropertyGrid by adding the component to your project.
At the end, you will be able to achieve the following result.
Prerequisites
Before adding the PropertyGrid, you need to:
-
Create your Telerik UI for WinUI application and install the Telerik UI for WinUI components depending on the required installation approach:
Add the Assembly References
To use the PropertyGrid component, add the references to the Telerik.WinUI.Controls.dll
assembly.
Define the Component
To start using the PropertyGrid, you need to initialize it and assign its Item
property. The following example shows how to bind the Item
to an object.
Define the Item Model
public class DataInfo
{
public int Id { get; set; }
public string Name { get; set; }
public bool IsChecked { get; set; }
public DateTime Date { get; set; }
public MyEnum EnumValue { get; set; }
public ObservableCollection<string> Strings { get; set; }
}
public enum MyEnum
{
ValueA,
ValueB
}
Define the PropertyGrid in XAML
<telerikControls:RadPropertyGrid x:Name="propertyGrid"/>
Set the Source of the PropertyGrid
public MainWindow()
{
this.InitializeComponent();
this.propertyGrid.Item = new DataInfo()
{
Id = 10,
Name = "Item 2022",
IsChecked = true,
Date = DateTime.Today,
EnumValue = MyEnum.ValueA,
Strings = new ObservableCollection<string>() { "Item 1", "Item 2", "Item 3", "Item 4" }
};
}