No,Category,Guideline,Description,Do,Don't,Code Good,Code Bad,Severity,Docs URL,Applies To,Status,Verified At
1,XAML,Use XAML for declarative UI,Define layout and visuals in XAML not code-behind,XAML for structure and styling,Build UI trees in C# code-behind,"","var btn = new Button(); btn.Content = ""Save"";",Low,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/xaml/,wpf current,active,2026-08-13
2,XAML,Set x:Class on root element,Connects XAML to its code-behind partial class,x:Class on Window UserControl and Page,Missing x:Class or mismatched namespace,"", without x:Class,High,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/xaml/,wpf current,active,2026-08-13
3,XAML,Use x:Name sparingly,Only name elements accessed from code-behind,x:Name when code-behind reference is needed,Naming every element,"",x:Name on every control,Low,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/xaml/,wpf current,active,2026-08-13
4,XAML,Prefer attached properties for layout,Grid.Row Grid.Column DockPanel.Dock etc,Attached properties for panel positioning,Margin hacks for alignment,"","",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/properties/attached-properties-overview,wpf current,active,2026-08-13
5,XAML,Use routed events for tree-wide handling,Events bubble up or tunnel down the element tree letting parents handle child events with one handler,Handler at parent using TypeName.EventName syntax with e.Handled=true when consumed,Wiring identical handlers on every child when one parent handler suffices,"","Click=""OnClick"" repeated on every Button under a common parent",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/events/routed-events-overview,wpf current,active,2026-08-13
6,Data Binding,Implement INotifyPropertyChanged,Enable UI updates when properties change,INotifyPropertyChanged on ViewModels,Public properties without notification,public string Name { get => _name; set { if (_name != value) { _name = value; OnPropertyChanged(); } } },public string Name { get; set; } without notification,High,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/data/how-to-implement-property-change-notification,wpf current,active,2026-08-13
7,Data Binding,Use ObservableCollection for lists,Notifies UI of add remove and reset,ObservableCollection for bound collections,List or Array for bound ItemsSources,ObservableCollection Items { get; } = new();,List Items { get; set; } = new();,High,https://learn.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1,wpf current,active,2026-08-13
8,Data Binding,Set DataContext at the right level,Enables binding for the visual subtree,DataContext on Window or root container,DataContext on every child control,"",Setting DataContext on each TextBlock individually,Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/data/,wpf current,active,2026-08-13
9,Data Binding,Prefer Binding over code-behind assignments,Declarative binding keeps UI and logic separate,{Binding Path=Name} in XAML,textBlock.Text = viewModel.Name in code-behind,"",Loaded event handler that sets every property,Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/data/data-binding-overview,wpf current,active,2026-08-13
10,Data Binding,Use UpdateSourceTrigger appropriately,Controls when source updates,PropertyChanged for instant feedback,Default LostFocus when search-as-you-type is needed,"Text=""{Binding Query, UpdateSourceTrigger=PropertyChanged}""","Text=""{Binding Query}"" when search-as-you-type needed",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/data/how-to-control-when-the-textbox-text-updates-the-source,wpf current,active,2026-08-13
11,Data Binding,Use IValueConverter for display transforms,Convert data for presentation without changing the model,IValueConverter for bool-to-visibility etc,Visibility properties on ViewModel,"",public Visibility IsActiveVisibility => IsActive ? Visibility.Visible : Visibility.Collapsed;,Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/data/how-to-convert-bound-data,wpf current,active,2026-08-13
12,Data Binding,Use INotifyDataErrorInfo for validation,Surface validation errors to the binding system instead of ad-hoc error UI,ObservableValidator with DataAnnotations attributes,Throwing in setters or maintaining separate error properties,public partial class FormVm : ObservableValidator { [ObservableProperty][NotifyDataErrorInfo][Required] private string _email; },"if (string.IsNullOrEmpty(Email)) ErrorMessage = ""Required"";",Medium,https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/observablevalidator,wpf current,active,2026-08-13
13,Layout,Use Grid for complex layouts,Rows and columns with proportional or fixed sizing,Grid with RowDefinitions and ColumnDefinitions,Canvas with absolute positions for forms,"","",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/grid,wpf current,active,2026-08-13
14,Layout,Use StackPanel for linear content,Simple vertical or horizontal stacking,StackPanel for toolbars and simple lists,Grid with single column for linear content,"",..12 Auto rows..,Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/stackpanel,wpf current,active,2026-08-13
15,Layout,Use DockPanel for docked regions,Dock children to edges with last child filling,DockPanel for shell layouts (menu top sidebar left),Nested StackPanels to simulate docking,"",Nested StackPanels with fixed widths for shell,Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/dockpanel,wpf current,active,2026-08-13
16,Layout,Avoid hardcoded sizes,Use Auto Star and MinWidth/MaxWidth,Proportional sizing with * and Auto,Fixed pixel widths on resizable content,""," on main content",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/grid,wpf current,active,2026-08-13
17,Layout,Use ScrollViewer for overflow,Wrap content that may exceed available space,ScrollViewer around long forms or lists,Clipping content without scroll,...long content..., that clips off-screen items,Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/scrollviewer,wpf current,active,2026-08-13
18,Styling,Use Resource Dictionaries,Centralize colors brushes and styles,ResourceDictionary in App.xaml for theme values,Inline colors and font sizes on every element,""," repeated everywhere",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/systems/xaml-resources-overview,wpf current,active,2026-08-13
19,Styling,Use pack URIs for embedded resources,Reference embedded images fonts and resource dictionaries via the pack scheme,"pack://application:,,, syntax for cross-assembly assets",File-system paths for resources compiled into the assembly,"","",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/app-development/pack-uris-in-wpf,wpf current,active,2026-08-13
20,Styling,Use implicit styles,Apply a Style to all instances of a TargetType,Style with TargetType and no x:Key for defaults,Manually styling every Button instance,"","Padding=""12,6"" on every Button",Medium,https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/styles-templates-overview,wpf current,active,2026-08-13
21,Styling,Use explicit styles with x:Key and BasedOn,Named variant styles that inherit from a base via BasedOn,x:Key styles that BasedOn an implicit or named style,Duplicating setters across variants,"