Help us improve
Share bugs, ideas, or general feedback.
From wpf-dev-pack
Explains WPF content model hierarchy: ContentControl (single content), ItemsControl (multiple items), Headered variants. Use for selecting base classes for custom controls or understanding content/items properties.
npx claudepluginhub christian289/dotnet-with-claudecode --plugin wpf-dev-packHow this skill is triggered — by the user, by Claude, or both
Slash command
/wpf-dev-pack:understanding-wpf-content-modelhaikuThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
WPF controls are classified into 4 main models based on how they contain content.
Guides WPF control authoring decisions: UserControl vs Control vs FrameworkElement selection, and Style/Template/Trigger alternatives. Use when creating new controls.
Designs WinUI 3 UIs and reviews XAML for correctness, covering layout planning, control selection, Fluent Design, theming (Light/Dark/HighContrast), typography, spacing, brushes, accessibility, and data binding.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Share bugs, ideas, or general feedback.
WPF controls are classified into 4 main models based on how they contain content.
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
<!-- 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>
<Button Content="Download">
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Path Data="M12,2L12,14L8,10L12,14L16,10L12,14"
Fill="White" Width="16"/>
<TextBlock Text="{Binding}" Margin="5,0,0,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
Advanced: See ADVANCED.md for creating custom ContentControl, ItemsControl, HeaderedContentControl-derived controls, custom ItemsPanel, and HierarchicalDataTemplate.
<!-- Direct item addition -->
<ListBox>
<ListBoxItem Content="Item 1"/>
<ListBoxItem Content="Item 2"/>
<ListBoxItem Content="Item 3"/>
</ListBox>
<!-- Data binding -->
<ListBox ItemsSource="{Binding Products}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Name}" FontWeight="Bold"/>
<TextBlock Text="{Binding Price, StringFormat=${0:N2}}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- GroupBox -->
<GroupBox Header="Settings">
<StackPanel>
<CheckBox Content="Option 1"/>
<CheckBox Content="Option 2"/>
</StackPanel>
</GroupBox>
<!-- Expander -->
<Expander Header="Details" IsExpanded="False">
<TextBlock Text="Content not visible when collapsed"/>
</Expander>
<!-- TabItem -->
<TabControl>
<TabItem Header="Tab 1">
<TextBlock Text="Tab 1 content"/>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Ellipse Width="8" Height="8" Fill="Green"/>
<TextBlock Text="Status" Margin="5,0,0,0"/>
</StackPanel>
</TabItem.Header>
<TextBlock Text="Tab 2 content"/>
</TabItem>
</TabControl>
<!-- TreeViewItem -->
<TreeView>
<TreeViewItem Header="Folder 1">
<TreeViewItem Header="File 1.txt"/>
<TreeViewItem Header="File 2.txt"/>
<TreeViewItem Header="Subfolder">
<TreeViewItem Header="File 3.txt"/>
</TreeViewItem>
</TreeViewItem>
</TreeView>
<!-- MenuItem -->
<Menu>
<MenuItem Header="File">
<MenuItem Header="New"/>
<MenuItem Header="Open"/>
<Separator/>
<MenuItem Header="Recent Files">
<MenuItem Header="file1.txt"/>
<MenuItem Header="file2.txt"/>
</MenuItem>
</MenuItem>
</Menu>
| Scenario | Recommended Base Class |
|---|---|
| Display single content | ContentControl |
| Single content + title | HeaderedContentControl |
| Display list/collection | ItemsControl |
| Selectable list | Selector (ListBox, ComboBox) |
| Hierarchical data | HeaderedItemsControl |
| Input field | TextBoxBase |
| Range value selection | RangeBase |
Content Set
↓
ContentTemplate exists?
├── Yes → Render with DataTemplate
└── No → Check Content type
├── UIElement → Render directly
├── String → Render with TextBlock
└── Other → ToString() then TextBlock