customizing-controltemplate

Solid

Customizes WPF control appearance using ControlTemplate with TemplateBinding and ContentPresenter. Use when completely changing control visuals, implementing state-based feedback, or TemplatedParent binding.

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 ControlTemplate Patterns All controls inherited from the Control class can completely redefine their visual structure through ControlTemplate. ## 1. Core Concepts ### ControlTemplate vs Style | Aspect | Style | ControlTemplate | |--------|-------|-----------------| | **Role** | Batch property value setting | Visual structure redefinition | | **Scope** | Property changes only | Full appearance change possible | | **Target** | All FrameworkElements | Control-derived classes only | ### ControlTemplate Components - **TargetType**: Control type to which the template applies - **TemplateBinding**: Connection to TemplatedParent properties - **ContentPresenter**: Specifies where Content property is rendered - **Triggers**: State-based visual changes --- ## 2. Basic Implementation Patterns ### 2.1 Button ControlTemplate (XAML) ```xml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style TargetType="{x:Type Button}" x:Key="RoundedButtonStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <!-- Visual structure definition --> <Border x:Name="PART_Border" CornerRadius="10" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding...

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