understanding-wpf-content-model

Solid

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

AI & Automation 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 Content Model Patterns WPF controls are classified into 4 main models based on how they contain content. ## 1. Content Model Hierarchy ``` Control ├── ContentControl (Single Content) │ ├── Button │ ├── Label │ ├── CheckBox │ ├── RadioButton │ ├── ToolTip │ ├── ScrollViewer │ ├── UserControl │ ├── Window │ └── HeaderedContentControl (Content + Header) │ ├── Expander │ ├── GroupBox │ └── TabItem │ └── ItemsControl (Multiple Items) ├── ListBox ├── ComboBox ├── ListView ├── TreeView ├── Menu ├── TabControl └── HeaderedItemsControl (Items + Header) ├── MenuItem ├── TreeViewItem └── ToolBar ``` --- ## 2. ContentControl ### 2.1 Characteristics - **Single Content property**: Holds only one child element - **Content type**: object (allows all types) - **ContentTemplate**: Specifies how Content is rendered ### 2.2 Basic Usage ```xml <!-- String content --> <Button Content="Click Me"/> <!-- Complex content --> <Button> <StackPanel Orientation="Horizontal"> <Image Source="/icon.png" Width="16"/> <TextBlock Text="Save" Margin="5,0,0,0"/> </StackPanel> </Button> ``` ### 2.3 Using ContentTemplate ```xml <Button Content="Download"> <Button.ContentTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Path Data="M12,2L12,14L8,10L12,14L16,10L12,14" Fill="White" Width="16"/...

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