Skip to content

Commit 9f52c56

Browse files
authored
Merge pull request #1 from SyncfusionExamples/985360
985360: Updated ReadMe file
2 parents 45ad307 + 9d5543f commit 9f52c56

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
1-
# How-to-set-description-to-the-property-items-of-WPF-PropertyGrid-through-attributes
2-
How to set description to the property items of WPF PropertyGrid through attributes
1+
# How to Set Descriptions for Property Items in WPF PropertyGrid Using Attributes
2+
## Overview
3+
In WPF applications, the PropertyGrid control is widely used to display and edit object properties in a structured and user-friendly way. While property names can be customized using the DisplayName attribute, you can further enhance the user experience by providing descriptions for each property.
4+
5+
These descriptions are typically shown as tooltips or in a description panel within the PropertyGrid, helping users understand the purpose of each property.
6+
7+
## Setting Descriptions with DescriptionAttribute
8+
To set descriptions for property items in the WPF PropertyGrid, use the DescriptionAttribute from the System.ComponentModel namespace. This allows you to annotate each property with a meaningful explanation, which is especially useful in complex forms or enterprise applications.
9+
### Example
10+
```C#
11+
using System.ComponentModel;
12+
13+
public class Product
14+
{
15+
[Description("The name of the product as it appears in the catalog.")]
16+
public string Name { get; set; }
17+
18+
[Description("The retail price of the product in INR.")]
19+
public double Price { get; set; }
20+
21+
[Description("The number of items currently available in inventory.")]
22+
public int Quantity { get; set; }
23+
}
24+
```
25+
When this class is bound to the Syncfusion WPF PropertyGrid, the grid will display:
26+
- User-friendly property names (if DisplayName is also used)
27+
- Descriptions as tooltips or in a dedicated description area
28+
29+
This improves usability and reduces the need for external documentation.

0 commit comments

Comments
 (0)