defining-wpf-dependencyproperty

Solid

Defines WPF DependencyProperty with Register, PropertyMetadata, callbacks, and validation. Use when creating custom controls, attached properties, or properties that support data binding and styling.

Data & Documents 40 stars 6 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
40
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# WPF DependencyProperty Patterns Defining dependency properties for data binding, styling, animation, and property value inheritance. **Advanced Patterns:** See [ADVANCED.md](ADVANCED.md) for value inheritance, metadata override, and event integration. ## 1. DependencyProperty Overview ``` Standard CLR Property: private string _name; public string Name { get => _name; set => _name = value; } DependencyProperty: public static readonly DependencyProperty NameProperty = ... public string Name { get => (string)GetValue(NameProperty); set => SetValue(NameProperty, value); } Benefits: ✅ Data Binding ✅ Styling & Templating ✅ Animation ✅ Property Value Inheritance ✅ Default Values ✅ Change Notifications ✅ Value Coercion ✅ Validation ``` --- ## 2. Basic DependencyProperty ### 2.1 Standard Registration ```csharp namespace MyApp.Controls; using System.Windows; using System.Windows.Controls; public class MyControl : Control { // 1. Register DependencyProperty public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( name: nameof(Title), propertyType: typeof(string), ownerType: typeof(MyControl), typeMetadata: new PropertyMetadata(defaultValue: string.Empty)); // 2. CLR property wrapper public string Title { get => (string)GetValue(TitleProperty); set => SetValue(TitleProperty, value); } } ``` ### 2.2 With FrameworkPropertyMeta...

Details

Author
christian289
Repository
christian289/dotnet-with-claudecode
Created
7 months ago
Last Updated
6 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

Data & Documents Featured

wpf

Build and modernize WPF applications on .NET with correct XAML, data binding, commands, threading, styling, and Windows desktop migration decisions. USE FOR: working on WPF UI, MVVM, binding, commands, or desktop modernization; migrating WPF from .NET Framework to .NET; integrating newer Windows capabilities into a WPF app. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

463 Updated 2 days ago
managedcode
Data & Documents Listed

wpf-mentor

Senior WPF and .NET desktop application architect and mentor. ALWAYS use this skill for any WPF, XAML, or MVVM question — including data binding, commands, dependency properties, ObservableCollection, INotifyPropertyChanged, styles, templates, resource dictionaries, UserControls, custom controls, navigation, validation, converters, async/Dispatcher, multithreading, EF Core integration, API integration, DI, logging, performance, memory management, and real-world desktop architecture. Trigger on: "teach me WPF", "explain MVVM", "how do I bind in WPF", "what is a DependencyProperty", "WPF interview questions", "how to structure a WPF app", "WPF production patterns", or any desktop .NET UI question. Use even for casual questions like "how does binding work?" or "why use MVVM?".

1 Updated 1 weeks ago
heyashishsaini
AI & Automation Solid

understanding-wpf-content-model

Explains WPF content model hierarchy including ContentControl, ItemsControl, and Headered variants. Use when selecting base classes for custom controls or understanding content/items properties.

40 Updated 6 days ago
christian289