Copilot instructions
.github/copilot-instructions.mdCopilot instructions
Quality
84/100
Scores the file, not the repository.Length
1,008 words
36 headings · 5 code blocksRepository
16k
— · pushed 1 days agoLast changed
3 days ago
First indexed 3 days ago.1# Copilot Instructions for MaterialDesignInXamlToolkit23## Repository Overview45The MaterialDesignInXamlToolkit is a **theme library** for WPF applications that provides Material Design themes and styling. This is NOT a control library - the focus is on theming existing WPF controls and providing custom controls only when necessary to support Google's Material Design specifications.67### Key Principles8- Theme library, not control library9- Styling existing WPF controls to match Material Design10- Custom controls only for Google-specified components that don't exist in WPF11- No application or business logic belongs in this library12- Provide base tools and springboard for developers to create their own controls1314## Architecture and Structure1516### Core Projects17- **`MaterialDesignThemes.Wpf`** - Main theming library with styles, templates, and controls18- **`MaterialDesignColors.Wpf`** - Color palette and theme management19- **`MaterialDesignThemes.MahApps`** - Integration with MahApps.Metro20- **`MainDemo.Wpf`** - Primary demonstration application21- **`MaterialDesign3.Demo.Wpf`** - Material Design 3 demonstration22- **`MaterialDesignToolkit.ResourceGeneration`** - Build-time resource generation tools2324### Key Technologies25- **WPF (Windows Presentation Foundation)** - UI framework26- **XAML** - Markup for UI definitions and styles27- **Material Design** - Google's design system implementation28- **.NET 8** and **.NET Framework 4.7.2** - Target frameworks for the library29- **.NET 9 SDK** - Required for building (as specified in `global.json`)30- **C# 12.0** - Programming language31- **PowerShell** - Build automation scripts3233## Development Environment3435### Requirements36- **Windows** - Required for WPF development and compilation37- **.NET 9 SDK** - As specified in `global.json` (note: projects target .NET 8 and .NET Framework 4.7.2)38- **Visual Studio 2022** or **Visual Studio Code** with C# extension39- **PowerShell** - For build scripts4041### Build and Test42```powershell43# Restore dependencies44dotnet restore MaterialDesignToolkit.Full.slnx4546# Build (requires Windows)47dotnet build MaterialDesignToolkit.Full.slnx --configuration Release --no-restore -p:Platform="Any CPU" -p:TreatWarningsAsErrors=True4849# Run tests50dotnet test MaterialDesignToolkit.Full.slnx --configuration Release --no-build5152# Build NuGet packages53.\build\BuildNugets.ps1 -MDIXVersion "x.x.x" -MDIXColorsVersion "x.x.x" -MDIXMahAppsVersion "x.x.x"54```5556## Code Style and Conventions5758### General Guidelines59- Follow standard Visual Studio settings with ReSharper suggestions60- Use .editorconfig settings (4-space indents for C#, 2-space for XAML/XML)61- Allman brace style (`csharp_new_line_before_open_brace = all`)62- No `this.` qualification unless necessary63- Prefer explicit types over `var` for built-in types64- Use PascalCase for public members, interfaces start with `I`6566### C# Conventions67```csharp68// Preferred dependency property pattern69public static readonly DependencyProperty MyPropertyProperty =70 DependencyProperty.Register("MyProperty", typeof(string), typeof(MyControl),71 new UIPropertyMetadata("DefaultValue", OnMyPropertyChanged));7273public string MyProperty74{75 get => (string)GetValue(MyPropertyProperty);76 set => SetValue(MyPropertyProperty, value);77}7879private static void OnMyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)80{81 var control = (MyControl)d;82 // Handle property change83}84```8586### XAML Style Guidelines87- Use XamlStyler settings from `Settings.XamlStyler`88- 2-space indentation for XAML89- Keep first attribute on same line as element90- Order attributes according to defined groups91- Use `{StaticResource}` over `{DynamicResource}` where possible92- Follow resource naming: `MaterialDesign.Brush.Primary.Light`9394## WPF and Material Design Context9596### Theme Architecture97- **Base Themes**: Light and Dark variants98- **Color System**: Primary, Secondary, Surface, Background colors with variants99- **Elevation**: Shadow and overlay systems for depth100- **Typography**: Material Design text styles101- **Motion**: Transitions and animations102103### Common Patterns104```csharp105// Theme modification pattern106private static void ModifyTheme(Action<Theme> modificationAction)107{108 var paletteHelper = new PaletteHelper();109 Theme theme = paletteHelper.GetTheme();110111 modificationAction?.Invoke(theme);112113 paletteHelper.SetTheme(theme);114}115116// Color adjustment usage117theme.ColorAdjustment = new ColorAdjustment118{119 DesiredContrastRatio = desiredRatio,120 Contrast = contrastValue,121 Colors = colorSelection122};123```124125### Resource Dictionary Patterns126```xml127<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"128 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"129 xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">130131 <ResourceDictionary.MergedDictionaries>132 <materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />133 <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/Generic.xaml" />134 </ResourceDictionary.MergedDictionaries>135136</ResourceDictionary>137```138139## Testing Approach140141### Test Structure142- **Unit Tests**: `MaterialDesignThemes.Wpf.Tests`, `MaterialDesignColors.Wpf.Tests`143- **UI Tests**: `MaterialDesignThemes.UITests` - Visual/integration testing144- **Demo Applications**: Manual testing and showcasing functionality145146### Test Patterns147```csharp148[Test]149public async Task ThemeTest_Example()150{151 await App.InitializeWithMaterialDesign(152 baseTheme: BaseTheme.Light,153 primary: PrimaryColor.Blue,154 secondary: SecondaryColor.Orange);155156 // Test implementation157}158```159160## Build Pipeline and Automation161162### GitHub Actions Workflows163- **PR Verification**: `pr_verification.yml` - Build and test on PRs164- **Build Artifacts**: `build_artifacts.yml` - Main build pipeline165- **Release**: `release.yml` - Create releases and publish NuGets166167### PowerShell Build Scripts168- **`BuildNugets.ps1`** - Package creation169- **`ApplyXamlStyler.ps1`** - Code formatting170- **`MigrateBrushes.ps1`** - Resource migration utilities171- **`UpdateNugets.ps1`** - Package management172173## Domain-Specific Knowledge174175### Material Design Implementation176- Follow Google Material Design guidelines strictly177- Implement elevation through shadows and overlays178- Use consistent color theming system179- Support both Material Design 2 and 3 specifications180- Ensure accessibility compliance (contrast ratios, touch targets)181182### WPF Theming Best Practices183- Use `TemplateBinding` for connecting to parent properties184- Implement proper focus visuals and keyboard navigation185- Support high contrast mode and accessibility features186- Use appropriate triggers for state changes (hover, pressed, disabled)187- Leverage WPF's dependency property system effectively188189### Resource Organization190- Brush resources: `MaterialDesign.Brush.*`191- Style resources: Clear, descriptive names matching WPF conventions192- Template resources: Match control types and variants193- Color resources: Follow Material Design naming (Primary, Secondary, Surface, etc.)194195## API Design Guidelines196197- **Maintain backward compatibility** - This is a widely-used library198- **Minimal public API surface** - Only expose what's necessary199- **Consistent naming** - Follow WPF and Material Design conventions200- **Proper documentation** - XML docs for all public APIs201- **Designer support** - Ensure controls work well in Visual Studio designer202203## Common Tasks and Patterns204205### Adding a New Style2061. Define in appropriate XAML resource dictionary2072. Follow existing naming conventions2083. Test in demo applications2094. Ensure accessibility compliance2105. Add to migration scripts if replacing existing styles211212### Theme Modifications2131. Use `PaletteHelper` for runtime theme changes2142. Support both static and dynamic resource binding2153. Test with both Light and Dark themes2164. Verify color adjustments work properly217218### Custom Control Development2191. Only when no WPF equivalent exists2202. Follow Material Design specifications exactly2213. Implement proper template parts and visual states2224. Support theming and color adjustments2235. Include comprehensive tests and demo usage224225Remember: This library's primary goal is to provide a complete, high-quality Material Design theming solution for WPF applications while maintaining excellent performance and broad compatibility.
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| pytorch/pytorch.github/copilot-instructions.md · 102k | Copilot instructions | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| dotnet/roslyn.github/instructions/Compiler.instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 99/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| hiyouga/LlamaFactory.github/copilot-instructions.md · 74k | Copilot instructions | setupbuildtestlint-format+5 | 97/100 | 2 days ago | |
| rtk-ai/rtk.github/copilot-instructions.md · 75k | Copilot instructions | buildtestlint-formatstyle+2 | 97/100 | 3 days ago | |
| dotnet/roslyn.github/copilot-instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 97/100 | 3 days ago |
