Controls with Custom Styles Fall Back to the Old Look Under the WPF Fluent Theme
Why controls carrying a custom Style keep the legacy look under the Fluent theme, how BasedOn fixes it, and which placements leave BasedOn unresolved.
Technical articles on WPF, XAML, C# and Windows application development.
Why controls carrying a custom Style keep the legacy look under the Fluent theme, how BasedOn fixes it, and which placements leave BasedOn unresolved.
The filter is correct right after assignment, yet an item property change leaves the list stale. Refresh and live filtering compared on .NET 10.
A ViewModel holds the right enum value, yet its radio button appears cleared. Omitting GroupName merges separate enum groups into one. Measured cause and fix.
The window is gone but the process stays in Task Manager. WPF shutdown has two gates, app shutdown and process exit, and the fix depends on which one stalled.
A dependency property gets its value, yet the internal {Binding Title} stays blank. RelativeSource, ElementName, and inner-root delegation compared on .NET 10.
Validation code runs but nothing appears. The causes are isolated on .NET 10: the ValidatesOnDataErrors default, a missing adorner layer, and update timing.
TreeView.SelectedItem cannot be assigned or data-bound: the selection lives on TreeViewItem. Style binding and ItemContainerGenerator are compared.
Bindings inside a DataTemplate resolve against the item, not the parent view model. Comparing RelativeSource, ElementName, x:Reference, and PlacementTarget.
A style trigger that never applies is usually outranked by a local value in XAML. Covers value precedence and the Setter, SetCurrentValue and ClearValue fixes.
An image file shown through BitmapImage cannot be deleted or overwritten. This covers the default caching behavior behind it and the OnLoad fix.
The default string sort orders "item10" before "item2". This shows how to reproduce Explorer's natural sort order via StrCmpLogicalW P/Invoke in an IComparer.
A custom RelayCommand's button stays stuck when CanExecuteChanged is never raised. This compares delegating to RequerySuggested with raising it manually.
Calling GetBindingExpression().UpdateSource() from the View has pitfalls: null returns, bulk updates, wrong direction, and MVVM, grounded in official docs.
TextBox.Text defaults to LostFocus, so typed input may never reach the ViewModel. This covers the three UpdateSourceTrigger values, their timing, and pitfalls.
Modifying a bound ObservableCollection off the UI thread throws a NotSupportedException from CollectionView affinity. This covers the cause and two fixes.
How to hide the clear button a Fluent-themed WPF TextBox shows on focus, without changing input behavior, on .NET 10 and .NET 9.
A ScrollViewer inside a StackPanel does not scroll because the StackPanel never constrains its height. This covers the cause and the Grid and DockPanel fixes.
A practical guide to formatting numbers, currency, and dates with Binding.StringFormat without a converter, including culture and ContentControl constraints.
Implementing CountBy, AggregateBy and Index with direct dictionary accumulation, avoiding the intermediate-grouping allocations of GroupBy.
Implementing LeftJoin, RightJoin and Shuffle on .NET Framework, mapping them to SQL outer joins and covering the IQueryable translation pitfall.
When a WPF Binding fails silently, Visual Studio logs it as a trace. This article covers reading the message, raising the trace level, and common patterns.
Recreating the .NET 8 selector-free ToDictionary overloads on .NET Framework as an exercise in overload resolution and notnull constraint design.
A delegation-only polyfill for Order and OrderDescending, focused on ThenBy compatibility via IOrderedEnumerable and runtime-specific sort exceptions.
Measuring the runtime cost of GroupBy and full-sort workaround idioms, then replacing them with Chunk, MaxBy, MinBy and DistinctBy polyfills.
Three design principles for hand-rolled LINQ polyfills, demonstrated through the Append, Prepend, TakeLast and SkipLast implementations.
Practical ways to reset WPF DataGrid sorting, including explicit clearing, Sorting-event control, CollectionView handling, and a reusable Behavior.
A version-by-version guide to C# operators and initialization syntax, built from actual compilation against net48. Shows which constructs need only LangVersi...
A C# 14 extension block can target a static class such as Directory, but only static members can be added. Instance members are rejected with CS0721 or CS930...
StaticResource resolves its value at XAML load time, so runtime changes have no effect. Use DynamicResource when the value must update at runtime.
Why rendering slows down when many WPF Labels are used, explained through measured visual tree data. Covers the gap against TextBlock, the extra cost imposed...
When a string containing an underscore (_) is set on a WPF Label, the character disappears from the screen. This article explains the underlying ContentPrese...
Use DataGridTemplateColumn with CellTemplate and CellEditingTemplate to separate display UI from editing UI in WPF DataGrid.
This article explains how TreePaste resolved a tray ContextMenu that stayed visible until an item was clicked by combining StaysOpen=false with SetForeground...
This article explains how to apply Fluent styling in WPF using only built-in features, with App.xaml theme setup and SystemColors-based color tracking.
Learn how to use a read-only TextBox as a TextBlock replacement in WPF so text remains selectable and copyable without allowing edits.
The correct combination of DisplayMemberPath, SelectedItem, SelectedValue, and SelectedValuePath depends on the element type bound to ItemsSource. This artic...
Why ListBox selection appears to vanish under UI virtualization, and how an IsSelected-based MVVM pattern keeps it stable. Includes measured evidence that th...
Learn the basics of DataGrid sorting and practical implementation patterns for real-world WPF applications.
A practical guide to changing the date display format of WPF DatePicker from XAML, code-behind, and a value converter.