configuring-wpf-themeinfo

Configures the ThemeInfo attribute in AssemblyInfo.cs for WPF CustomControl Generic.xaml auto-loading.

Updated Nov 22, 2023
Ready to run
npx skills add https://github.com/parksanghoon-sys/TestCode --skill configuring-wpf-themeinfo-parksanghoon-sys
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: configuring-wpf-themeinfo
Source: https://github.com/parksanghoon-sys/TestCode/tree/main/src/Modbus/wpf-dev-pack/.agents/skills/configuring-wpf-themeinfo
Command: npx skills add https://github.com/parksanghoon-sys/TestCode --skill configuring-wpf-themeinfo-parksanghoon-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? WPF CustomControl styles defined in Themes/Generic.xaml fail to load at runtime when the ThemeInfo attribute is missing or misconfigured in AssemblyInfo.cs, leaving controls blank or unstyled. ## Core Features & Use Cases - ThemeInfo Configuration: Provides the exact AssemblyInfo.cs attribute setup with correct ResourceDictionaryLocation values for Generic.xaml auto-loading. - Anti-Pattern Detection: Explains why loading Generic.xaml through App.xaml MergedDictionaries breaks cross-assembly style resolution and how to fix it. - Troubleshooting Guide: Maps common symptoms like unapplied styles to root causes including missing DefaultStyleKeyProperty overrides and wrong file paths. - Use Case: You create a WPF Custom Control Library, reference it from another application, and the custom control renders without any style. This Skill walks you through adding ThemeInfo and DefaultStyleKeyProperty so styles load automatically in any consuming app. ## Quick Start Ask the AI to configure the ThemeInfo attribute in AssemblyInfo.cs so my WPF Custom Control Library loads its Generic.xaml styles automatically.

Frequently Asked Questions about configuring-wpf-themeinfo

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why is my WPF CustomControl style in Generic.xaml not being applied?▼

The most common cause is a missing ThemeInfo attribute in AssemblyInfo.cs, which prevents WPF from locating Themes/Generic.xaml. Also verify the file is at the exact path Themes/Generic.xaml and that DefaultStyleKeyProperty is overridden in the control's static constructor.

How do I configure ThemeInfo in AssemblyInfo.cs for a WPF control library?▼

Add [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] to Properties/AssemblyInfo.cs. The second parameter must be SourceAssembly so WPF loads Themes/Generic.xaml from the current assembly.

Should I load Generic.xaml through App.xaml MergedDictionaries?▼

No. Loading CustomControl styles via App.xaml MergedDictionaries breaks when another assembly references your control library, because the consuming app lacks your merged dictionary. Use the ThemeInfo attribute instead so the library is self-contained.

What does DefaultStyleKeyProperty do in a WPF CustomControl?▼

DefaultStyleKeyProperty.OverrideMetadata in the static constructor tells WPF which TargetType style to apply to the control. It works together with ThemeInfo: ThemeInfo locates Generic.xaml, and the style key matches the style by TargetType.

Why does my control style work in one app but not when referenced from another assembly?▼

This happens when styles are loaded through the consuming app's App.xaml instead of the ThemeInfo attribute. Moving style loading to ThemeInfo in the control library makes styles resolve automatically in any consuming application.