From 4a1de430df33f10e62886f42b04c399dbd623820 Mon Sep 17 00:00:00 2001 From: KrithikaGanesan Date: Thu, 9 Oct 2025 16:37:09 +0530 Subject: [PATCH 1/2] 985360: Check and update the invalidate sample repositories for desktop tools controls --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3517e00..1c30e65 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Filtering-the-property-items-of-PropertyGrid-through-attributes -Filtering the property items of PropertyGrid through attributes +Filtering properties of WPF PropertyGrid through event handling is a powerful technique that allows developers to dynamically control which properties are displayed in the PropertyGrid at runtime. This is particularly useful in scenarios where the visibility of certain properties depends on user interactions, application state, or specific business logic. By leveraging events such as PropertyFilterChanged or custom logic tied to UI triggers, developers can intercept the property rendering process and apply filters based on type, category, name, or custom attributes. For example, you might want to hide advanced settings from novice users or show additional configuration options only when a checkbox is selected. This dynamic filtering enhances user experience by keeping the interface clean and relevant. Implementing this typically involves subscribing to the appropriate event, evaluating the property metadata, and modifying the property list accordingly. WPF’s extensibility makes it possible to integrate such behavior seamlessly into MVVM architectures, ensuring maintainability and scalability. \ No newline at end of file From c584c3971e76059cf0541ebf80fa5200faef41bc Mon Sep 17 00:00:00 2001 From: Manivannan-E <92844213+Manivannan-E@users.noreply.github.com> Date: Tue, 4 Nov 2025 17:13:17 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1c30e65..5065b41 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,41 @@ -# Filtering-the-property-items-of-PropertyGrid-through-attributes -Filtering properties of WPF PropertyGrid through event handling is a powerful technique that allows developers to dynamically control which properties are displayed in the PropertyGrid at runtime. This is particularly useful in scenarios where the visibility of certain properties depends on user interactions, application state, or specific business logic. By leveraging events such as PropertyFilterChanged or custom logic tied to UI triggers, developers can intercept the property rendering process and apply filters based on type, category, name, or custom attributes. For example, you might want to hide advanced settings from novice users or show additional configuration options only when a checkbox is selected. This dynamic filtering enhances user experience by keeping the interface clean and relevant. Implementing this typically involves subscribing to the appropriate event, evaluating the property metadata, and modifying the property list accordingly. WPF’s extensibility makes it possible to integrate such behavior seamlessly into MVVM architectures, ensuring maintainability and scalability. \ No newline at end of file +# Filtering Property Items of Syncfusion WPF PropertyGrid Through Attributes +## Overview +The Syncfusion WPF PropertyGrid control allows developers to filter or hide specific properties using standard .NET attributes. This approach is ideal when you want to statically control which properties are visible in the PropertyGrid without writing additional event-handling logic. + +## Why Use Attribute-Based Filtering? +Attribute-based filtering is: +- **Declarative**: You define visibility directly in the model class. +- **Simple**: No need for runtime logic or event subscriptions. +- **Maintainable**: Easy to manage and understand in large codebases. + +## Supported Attributes +### 1. [Browsable(false)] +This attribute hides the property from the PropertyGrid. + +```C# +using System.ComponentModel; + +public class Employee +{ + public string Name { get; set; } + + [Browsable(false)] + public string InternalCode { get; set; } + + public int Age { get; set; } +} +``` + +### 2. [Bindable(false)] +This also hides the property from the PropertyGrid. It functions similarly to [Browsable(false)]. +```C# +using System.ComponentModel; + +public class Employee +{ + public string Name { get; set; } + + [Bindable(false)] + public string SecretKey { get; set; } +} +```