Skip to content

Commit 577b730

Browse files
authored
Merge pull request #1 from SyncfusionExamples/985360
985360: Updated ReadMe file
2 parents e2d205e + 03be1e1 commit 577b730

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
# How-to-set-desired-name-to-the-property-items-of-WPF-PropertyGrid-through-attributes
2-
How to set desired name to the property items of WPF PropertyGrid through attributes
1+
# How to Set Desired Names for Property Items in WPF PropertyGrid Using Attributes
2+
## Overview
3+
In WPF applications, the PropertyGrid control is a powerful tool for displaying and editing the properties of an object. However, by default, it shows raw property names, which may not be user-friendly. To improve the user experience, you can customize these display names using attributes.
4+
5+
Syncfusion’s WPF PropertyGrid supports this customization through the use of the DisplayName and Name attributes.
6+
7+
## Customizing Property Names with DisplayName
8+
To set a custom name for a property item, decorate the property in your model class with the DisplayName attribute from the System.ComponentModel namespace. This attribute overrides the default property name shown in the grid.
9+
### Example
10+
```csharp
11+
using System.ComponentModel;
12+
13+
public class Employee
14+
{
15+
[DisplayName("Employee Name")]
16+
public string Name { get; set; }
17+
18+
[DisplayName("Employee Age")]
19+
public int Age { get; set; }
20+
21+
[DisplayName("Department")]
22+
public string Dept { get; set; }
23+
}
24+
```
25+
When this class is bound to the Syncfusion PropertyGrid, the grid will display:
26+
- Employee Name
27+
- Employee Age
28+
- Department
29+
30+
instead of the actual property names (Name, Age, Dept). This makes the UI more intuitive and readable for end users.

0 commit comments

Comments
 (0)