<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: s-iguchi09</title>
    <description>The latest articles on DEV Community by s-iguchi09 (@s-iguchi09).</description>
    <link>https://dev.to/s-iguchi09</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4116074%2Fced7d4a4-c3cc-41a4-bf13-70305f1b7475.png</url>
      <title>DEV Community: s-iguchi09</title>
      <link>https://dev.to/s-iguchi09</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/s-iguchi09"/>
    <language>en</language>
    <item>
      <title>Controls with Custom Styles Fall Back to the Old Look Under the WPF Fluent Theme</title>
      <dc:creator>s-iguchi09</dc:creator>
      <pubDate>Tue, 08 Sep 2026 16:14:33 +0000</pubDate>
      <link>https://dev.to/s-iguchi09/controls-with-custom-styles-fall-back-to-the-old-look-under-the-wpf-fluent-theme-46ah</link>
      <guid>https://dev.to/s-iguchi09/controls-with-custom-styles-fall-back-to-the-old-look-under-the-wpf-fluent-theme-46ah</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Originally published at &lt;a href="https://s-iguchi09.github.io/articles/wpf-fluent-theme-custom-style-not-applied/" rel="noopener noreferrer"&gt;s-iguchi09.github.io&lt;/a&gt;.&lt;br&gt;
A &lt;a href="https://s-iguchi09.github.io/ja/articles/wpf-fluent-theme-custom-style-not-applied/" rel="noopener noreferrer"&gt;Japanese version&lt;/a&gt; is also available.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;After the Fluent theme is introduced into an existing WPF application, some controls may keep their previous squared-off appearance instead of adopting the Fluent look.&lt;br&gt;
The symptom appears on controls that carry a &lt;code&gt;Style&lt;/code&gt; which is not chained to the Fluent style through &lt;code&gt;BasedOn&lt;/code&gt;.&lt;br&gt;
An &lt;strong&gt;implicit style&lt;/strong&gt; such as &lt;code&gt;&amp;lt;Style TargetType="Button"&amp;gt;&lt;/code&gt; is the most common way an application ends up in that state without the author noticing.&lt;br&gt;
Setting &lt;code&gt;Style="{x:Null}"&lt;/code&gt; to opt out of style application leaves the same legacy look.&lt;br&gt;
No exception is raised, no warning appears, and the output window stays silent, so the theme setup itself is easily mistaken for the cause.&lt;/p&gt;

&lt;p&gt;This article explains the behavior from how the Fluent theme is delivered to controls, and presents the fix based on &lt;code&gt;BasedOn&lt;/code&gt;.&lt;br&gt;
It also documents the placements where &lt;code&gt;BasedOn&lt;/code&gt; is written but never resolved, using a results table produced by measurement.&lt;/p&gt;


&lt;h2&gt;
  
  
  Prerequisites / Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Framework: WPF on .NET 9 / .NET 10 (&lt;code&gt;net9.0-windows&lt;/code&gt; / &lt;code&gt;net10.0-windows&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;OS: Windows 11 (standard colors; high contrast is out of scope)&lt;/li&gt;
&lt;li&gt;Theme activation: the &lt;code&gt;ThemeMode&lt;/code&gt; property, or merging the &lt;code&gt;Fluent.xaml&lt;/code&gt; resource dictionary directly&lt;/li&gt;
&lt;li&gt;Target: styles declared in &lt;code&gt;Application.Resources&lt;/code&gt;, &lt;code&gt;Window.Resources&lt;/code&gt;, or a separate resource dictionary file&lt;/li&gt;
&lt;li&gt;Architecture: the behavior is identical for MVVM and code-behind&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ThemeMode&lt;/code&gt; exists on both &lt;code&gt;Application&lt;/code&gt; and &lt;code&gt;Window&lt;/code&gt;, so the theme can be set for the whole application or per window.&lt;br&gt;
The results table below includes combinations whose result depends on which one carries the setting.&lt;/p&gt;

&lt;p&gt;The pack URI for merging &lt;code&gt;Fluent.xaml&lt;/code&gt; directly is the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pack://application:,,,/PresentationFramework.Fluent;component/Themes/Fluent.xaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assign this URI to the &lt;code&gt;Source&lt;/code&gt; of a &lt;code&gt;ResourceDictionary&lt;/code&gt;.&lt;br&gt;
With &lt;code&gt;ThemeMode&lt;/code&gt;, that markup is unnecessary.&lt;br&gt;
In measurement, setting &lt;code&gt;ThemeMode&lt;/code&gt; merged the resolved &lt;code&gt;Fluent.Light.xaml&lt;/code&gt; or &lt;code&gt;Fluent.Dark.xaml&lt;/code&gt; automatically.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ThemeMode&lt;/code&gt; is published as an experimental API.&lt;br&gt;
Every implementation in this article sets it as a XAML attribute, so no suppression is required, but as &lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/whats-new/net90#thememode" rel="noopener noreferrer"&gt;what's new in WPF for .NET 9&lt;/a&gt; states, accessing it from code produces error &lt;code&gt;WPF0001&lt;/code&gt;.&lt;br&gt;
In that case, suppress it with &lt;code&gt;&amp;lt;NoWarn&amp;gt;$(NoWarn);WPF0001&amp;lt;/NoWarn&amp;gt;&lt;/code&gt; in the project file, or with &lt;code&gt;#pragma warning disable WPF0001&lt;/code&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;Enabling the Fluent theme takes a single attribute.&lt;br&gt;
Setting &lt;code&gt;ThemeMode&lt;/code&gt; on the &lt;code&gt;Application&lt;/code&gt; element in &lt;code&gt;App.xaml&lt;/code&gt; gives the whole application the Fluent appearance.&lt;br&gt;
The problem appears when the existing &lt;code&gt;App.xaml&lt;/code&gt; already carries an implicit style.&lt;br&gt;
The following &lt;code&gt;App.xaml&lt;/code&gt; applies the Fluent theme while widening the padding of &lt;code&gt;Button&lt;/code&gt; as before.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Application&lt;/span&gt; &lt;span class="na"&gt;x:Class=&lt;/span&gt;&lt;span class="s"&gt;"MyApp.App"&lt;/span&gt;
             &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
             &lt;span class="na"&gt;xmlns:x=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
             &lt;span class="na"&gt;StartupUri=&lt;/span&gt;&lt;span class="s"&gt;"MainWindow.xaml"&lt;/span&gt;
             &lt;span class="na"&gt;ThemeMode=&lt;/span&gt;&lt;span class="s"&gt;"Light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Application.Resources&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Style&lt;/span&gt; &lt;span class="na"&gt;TargetType=&lt;/span&gt;&lt;span class="s"&gt;"Button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;Setter&lt;/span&gt; &lt;span class="na"&gt;Property=&lt;/span&gt;&lt;span class="s"&gt;"Padding"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"16,6"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/Style&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Application.Resources&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Application&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The style only adds &lt;code&gt;Padding&lt;/code&gt;, and neither the template nor the colors are touched.&lt;br&gt;
Even so, the &lt;code&gt;Button&lt;/code&gt; does not adopt the Fluent appearance at run time.&lt;br&gt;
A &lt;code&gt;CheckBox&lt;/code&gt; placed in the same window renders with the Fluent look, which shows that the theme itself is active.&lt;/p&gt;


  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs-iguchi09.github.io%2Fimages%2Farticles%2Fwpf-fluent-theme-custom-style-not-applied%2Fimplicit-style-shadows-fluent.png" alt="A WPF window with the Fluent theme applied. The Save button has square corners and a gray background in the legacy appearance, while the Overwrite check box below it uses the rounded Fluent appearance." width="286" height="183"&gt;The state produced by the &lt;code&gt;App.xaml&lt;/code&gt; above, with the &lt;code&gt;{x:Type Button}&lt;/code&gt; implicit style placed directly in &lt;code&gt;Application.Resources&lt;/code&gt;. Captured on Windows 11 / .NET 10 with &lt;code&gt;ThemeMode=Light&lt;/code&gt;. The &lt;code&gt;Button&lt;/code&gt; has square corners and a gray background, while the untouched &lt;code&gt;CheckBox&lt;/code&gt; stays Fluent.
  


&lt;p&gt;Inspecting this button's template on .NET 10 with &lt;code&gt;ThemeMode=Light&lt;/code&gt; shows a &lt;code&gt;CornerRadius&lt;/code&gt; of &lt;code&gt;0&lt;/code&gt; and a background of &lt;code&gt;#FFDDDDDD&lt;/code&gt; on the inner &lt;code&gt;Border&lt;/code&gt;.&lt;br&gt;
&lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/whats-new/net90#thememode" rel="noopener noreferrer"&gt;What's new in WPF for .NET 9&lt;/a&gt; states that the default &lt;code&gt;ThemeMode&lt;/code&gt; of &lt;code&gt;None&lt;/code&gt; uses &lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/controls/styles-templates-overview#available-built-in-themes" rel="noopener noreferrer"&gt;Aero2&lt;/a&gt;.&lt;br&gt;
The measured values match the Aero2 &lt;code&gt;Button&lt;/code&gt; on Windows 11 with standard colors, which confirms that no part of the Fluent style is in effect.&lt;/p&gt;


&lt;h2&gt;
  
  
  Cause / Background
&lt;/h2&gt;

&lt;p&gt;The cause lies in the path through which the Fluent theme reaches a control.&lt;/p&gt;
&lt;h3&gt;
  
  
  Fluent is delivered as implicit styles, not as a theme style
&lt;/h3&gt;

&lt;p&gt;The earlier WPF themes such as Aero2 are applied as the &lt;strong&gt;theme style&lt;/strong&gt; of a control.&lt;br&gt;
&lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/properties/dependency-property-value-precedence" rel="noopener noreferrer"&gt;Dependency property value precedence&lt;/a&gt; ranks the theme style as the weakest source among styles, with values from the application's own style layered above it.&lt;br&gt;
Measurement confirms that a control carrying an implicit style that sets nothing but &lt;code&gt;Padding&lt;/code&gt; still receives the Aero2 template.&lt;br&gt;
Unless &lt;a href="https://learn.microsoft.com/dotnet/api/system.windows.frameworkelement.overridesdefaultstyle" rel="noopener noreferrer"&gt;&lt;code&gt;OverridesDefaultStyle&lt;/code&gt;&lt;/a&gt; is set to &lt;code&gt;true&lt;/code&gt;, a theme style keeps supplying the template even when the application assigns &lt;code&gt;Style&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The Fluent theme does not use that path.&lt;br&gt;
The reference for the &lt;a href="https://learn.microsoft.com/dotnet/api/system.windows.application.thememode" rel="noopener noreferrer"&gt;&lt;code&gt;Application.ThemeMode&lt;/code&gt; property&lt;/a&gt; states that setting the property loads the Fluent theme dictionaries into the application resources.&lt;br&gt;
As far as style delivery is concerned, Fluent arrives as a &lt;strong&gt;resource dictionary merged into the resources of the element that carries &lt;code&gt;ThemeMode&lt;/code&gt;&lt;/strong&gt; rather than as a theme style.&lt;br&gt;
The reference for the &lt;a href="https://learn.microsoft.com/dotnet/api/system.windows.window.thememode" rel="noopener noreferrer"&gt;&lt;code&gt;Window.ThemeMode&lt;/code&gt; property&lt;/a&gt; likewise states that setting it on a &lt;code&gt;Window&lt;/code&gt; loads the Fluent theme dictionaries into that window's resources.&lt;br&gt;
The dictionary also holds many brushes and numeric resources; the implicit styles keyed by values such as &lt;code&gt;{x:Type Button}&lt;/code&gt; are one part of it.&lt;/p&gt;

&lt;p&gt;This difference is observable in measurement.&lt;br&gt;
A control with &lt;code&gt;Style="{x:Null}"&lt;/code&gt;, which explicitly opts out of style application, renders with the Aero2 appearance even while the Fluent theme is active.&lt;br&gt;
If Fluent were supplied as a theme style, clearing &lt;code&gt;Style&lt;/code&gt; would leave the Fluent appearance in place.&lt;/p&gt;
&lt;h3&gt;
  
  
  A style with the same key hides the Fluent style
&lt;/h3&gt;

&lt;p&gt;The key of the Fluent implicit style is exactly the key that &lt;code&gt;&amp;lt;Style TargetType="Button"&amp;gt;&lt;/code&gt; produces in application code: &lt;code&gt;{x:Type Button}&lt;/code&gt;.&lt;br&gt;
When the same key exists in two places, resource lookup rules determine which one is used.&lt;br&gt;
In both placements described below, the application style is the one selected.&lt;/p&gt;

&lt;p&gt;For a style placed directly in &lt;code&gt;Application.Resources&lt;/code&gt;, the outcome follows the precedence between a dictionary and the dictionaries merged into it.&lt;br&gt;
The article on &lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/systems/xaml-resources-merged-dictionaries" rel="noopener noreferrer"&gt;merged resource dictionaries&lt;/a&gt; states that when a key is defined in the primary dictionary and also in a merged dictionary, the resource returned comes from the primary dictionary.&lt;br&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; adds Fluent as a merged dictionary, so the style written directly in &lt;code&gt;Application.Resources&lt;/code&gt; takes precedence.&lt;/p&gt;

&lt;p&gt;For a style placed in an inner scope such as &lt;code&gt;Window.Resources&lt;/code&gt;, the outcome follows scope proximity.&lt;br&gt;
The article on &lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/controls/styles-templates-overview#shared-resources-and-themes" rel="noopener noreferrer"&gt;styles and templates&lt;/a&gt; explains that the search for an element's style walks up the element tree, then looks in the application resources, and consults the theme last.&lt;br&gt;
&lt;code&gt;Window.Resources&lt;/code&gt; is examined before &lt;code&gt;Application.Resources&lt;/code&gt;, so the application style is selected.&lt;/p&gt;

&lt;p&gt;In both cases the application style does not &lt;strong&gt;extend&lt;/strong&gt; the Fluent style; it &lt;strong&gt;replaces and hides&lt;/strong&gt; it entirely.&lt;br&gt;
Once hidden, the Fluent template is no longer supplied, and the control falls back to the built-in WPF theme style, Aero2.&lt;br&gt;
That is why a style adding nothing but &lt;code&gt;Padding&lt;/code&gt; discards the whole Fluent appearance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;All of this describes a style written without &lt;code&gt;BasedOn&lt;/code&gt;.&lt;/strong&gt; Where the original can be inherited through &lt;code&gt;BasedOn&lt;/code&gt;, the template survives while your own setters still apply.&lt;br&gt;
The last two rows of the figure below measure that for a &lt;code&gt;TextBox&lt;/code&gt; style placed in &lt;code&gt;Window.Resources&lt;/code&gt;.&lt;br&gt;
Depending on where the style lives, though, &lt;code&gt;BasedOn&lt;/code&gt; itself may fail to resolve. The Solution section covers that condition.&lt;/p&gt;



&lt;p&gt;Which source supplied the template can be told apart by the named parts inside it.&lt;br&gt;
The Fluent &lt;code&gt;TextBox&lt;/code&gt; template holds a &lt;code&gt;DeleteButton&lt;/code&gt;; the classic theme does not.&lt;/p&gt;


  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs-iguchi09.github.io%2Fimages%2Farticles%2Fwpf-fluent-textbox-hide-clear-button%2Ffluent-textbox-parts.svg" alt="A table of the named parts in the TextBox template per way the theme reaches the control. DeleteButton is present on the row where ThemeMode is set and on the row merging Fluent.xaml directly. An implicit style without BasedOn removes DeleteButton on either route, leaving only PART_ContentHost, while the rows whose implicit style inherits through BasedOn keep DeleteButton on both routes." width="913" height="320"&gt;Measured on .NET 10 / Windows 11. The &lt;code&gt;Style applied&lt;/code&gt; column reports whether the &lt;code&gt;Style&lt;/code&gt; property is filled in (an implicit style) or left &lt;code&gt;null&lt;/code&gt; (a classic theme style).
  


&lt;p&gt;&lt;strong&gt;The point is the second row, where &lt;code&gt;Style applied&lt;/code&gt; reads &lt;code&gt;implicit style&lt;/code&gt;.&lt;/strong&gt; Setting &lt;code&gt;ThemeMode&lt;/code&gt; alone fills in the &lt;code&gt;Style&lt;/code&gt; property, showing that Fluent arrives as an implicit style rather than a theme style.&lt;br&gt;
On the first row, without &lt;code&gt;ThemeMode&lt;/code&gt;, &lt;code&gt;Style&lt;/code&gt; stays &lt;code&gt;null&lt;/code&gt; and the template comes from the classic theme style.&lt;/p&gt;

&lt;p&gt;On the third row, an application-side implicit style under the same key that carries no &lt;code&gt;BasedOn&lt;/code&gt; makes &lt;code&gt;DeleteButton&lt;/code&gt; disappear.&lt;br&gt;
&lt;code&gt;Padding&lt;/code&gt; reads 8, so the application style did take effect. &lt;strong&gt;It is precisely because it took effect that the Fluent style was replaced and its template lost with it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The last two rows inherit the original through &lt;code&gt;BasedOn&lt;/code&gt;. On both routes — &lt;code&gt;ThemeMode&lt;/code&gt; and a direct merge of &lt;code&gt;Fluent.xaml&lt;/code&gt; — &lt;code&gt;Padding&lt;/code&gt; reads 8 just the same and &lt;code&gt;DeleteButton&lt;/code&gt; survives.&lt;/p&gt;

&lt;p&gt;What this figure measures is an implicit &lt;code&gt;TextBox&lt;/code&gt; style placed in &lt;code&gt;Window.Resources&lt;/code&gt;.&lt;br&gt;
A &lt;code&gt;Button&lt;/code&gt;, or a style placed directly in &lt;code&gt;Application.Resources&lt;/code&gt;, lands elsewhere; the table in the Solution section covers those.&lt;/p&gt;


&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;Add &lt;code&gt;BasedOn&lt;/code&gt; to the style so that it inherits the Fluent implicit style.&lt;br&gt;
Writing &lt;code&gt;BasedOn="{StaticResource {x:Type Button}}"&lt;/code&gt; layers the local &lt;code&gt;Setter&lt;/code&gt; elements on top of the Fluent style.&lt;/p&gt;

&lt;p&gt;This markup carries one constraint that must be respected.&lt;br&gt;
&lt;strong&gt;When the key passed to &lt;code&gt;BasedOn&lt;/code&gt; is the same as the style's own key, and that key also exists in a dictionary merged into the dictionary declaring the style (including nested merged dictionaries), &lt;code&gt;BasedOn&lt;/code&gt; is left unresolved and stays &lt;code&gt;null&lt;/code&gt;.&lt;/strong&gt;&lt;br&gt;
No exception is raised, and the legacy appearance remains.&lt;br&gt;
This condition was derived from measurement on .NET 9 and .NET 10; it is not a description of how &lt;code&gt;StaticResource&lt;/code&gt; resolves internally.&lt;/p&gt;

&lt;p&gt;Declaring an implicit style directly inside &lt;code&gt;Application.Resources&lt;/code&gt; meets that condition.&lt;br&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; adds the Fluent dictionaries as merged dictionaries of the very &lt;code&gt;Application.Resources&lt;/code&gt; that declares the style.&lt;/p&gt;

&lt;p&gt;The rule above states only when the reference &lt;strong&gt;fails&lt;/strong&gt;, and the converse does not hold: avoiding the condition does not guarantee that &lt;code&gt;BasedOn&lt;/code&gt; reaches Fluent.&lt;br&gt;
As the table below shows, some placements fail to reach Fluent without meeting the condition.&lt;/p&gt;

&lt;p&gt;The figure below contrasts placing the style directly in &lt;code&gt;Application.Resources&lt;/code&gt; with moving it into a dedicated resource dictionary file, referred to here as &lt;code&gt;Styles.xaml&lt;/code&gt;.&lt;/p&gt;


  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs-iguchi09.github.io%2Fimages%2Farticles%2Fwpf-fluent-theme-custom-style-not-applied%2Fbasedon-lookup-scope.svg" alt="On the left, a style placed directly in Application.Resources, where the path toward Fluent.Light.xaml inside MergedDictionaries is blocked and BasedOn becomes null. On the right, Styles.xaml added to MergedDictionaries, where the style inside it reaches Fluent.Light.xaml in the same MergedDictionaries." width="780" height="360"&gt;The relationship between the &lt;code&gt;BasedOn&lt;/code&gt; target and the dictionary that declares the style. A dashed frame is &lt;code&gt;MergedDictionaries&lt;/code&gt;, a white box is a resource dictionary, and the lighter box inside it is a style. On the left the style sits directly in &lt;code&gt;Application.Resources&lt;/code&gt;, so the referenced key matches the style's own key and also exists in a dictionary merged into that same dictionary, leaving it unresolved. On the right the style lives in a separate file inside &lt;code&gt;MergedDictionaries&lt;/code&gt;, so it reaches the Fluent entry in the same &lt;code&gt;MergedDictionaries&lt;/code&gt;. Both set &lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;, and both were confirmed on .NET 9 and .NET 10 running Windows 11.
  


&lt;p&gt;A failed reference can be spotted quickly by inspecting the style at run time.&lt;br&gt;
For a style placed in &lt;code&gt;Application.Resources&lt;/code&gt;, &lt;code&gt;basedOn&lt;/code&gt; below being &lt;code&gt;null&lt;/code&gt; means it did not resolve.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;Style&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="n"&gt;style&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Current&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Resources&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;Style&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;Style&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="n"&gt;basedOn&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="n"&gt;BasedOn&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a style placed in &lt;code&gt;Window.Resources&lt;/code&gt;, read the target window's &lt;code&gt;Resources&lt;/code&gt; the same way instead of &lt;code&gt;Application.Current.Resources&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This check misses cases, however.&lt;br&gt;
A non-&lt;code&gt;null&lt;/code&gt; &lt;code&gt;basedOn&lt;/code&gt; can still point at the default theme style rather than at Fluent.&lt;br&gt;
Make the final call by rendering the control and looking for Fluent-specific traits such as rounded corners.&lt;/p&gt;

&lt;p&gt;The configuration that reliably inherits Fluent is therefore the following.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set &lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;, not on a &lt;code&gt;Window&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Keep the style out of &lt;code&gt;Application.Resources&lt;/code&gt; itself (moving it into a dedicated resource dictionary file and merging that file is the most manageable way to do so).&lt;/li&gt;
&lt;li&gt;Do not merge the Fluent dictionary inside that file.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;BasedOn="{StaticResource {x:Type Button}}"&lt;/code&gt; to the style.&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Move the style into a separate resource dictionary
&lt;/h3&gt;

&lt;p&gt;First, extract the implicit style into &lt;code&gt;Styles.xaml&lt;/code&gt;.&lt;br&gt;
Specify &lt;code&gt;{StaticResource {x:Type Button}}&lt;/code&gt; for &lt;code&gt;BasedOn&lt;/code&gt; so the Fluent style becomes the base.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ResourceDictionary&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
                    &lt;span class="na"&gt;xmlns:x=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Style&lt;/span&gt; &lt;span class="na"&gt;TargetType=&lt;/span&gt;&lt;span class="s"&gt;"Button"&lt;/span&gt; &lt;span class="na"&gt;BasedOn=&lt;/span&gt;&lt;span class="s"&gt;"{StaticResource {x:Type Button}}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Setter&lt;/span&gt; &lt;span class="na"&gt;Property=&lt;/span&gt;&lt;span class="s"&gt;"Padding"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"16,6"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Style&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ResourceDictionary&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do not merge the Fluent dictionary into this file.&lt;br&gt;
Merging &lt;code&gt;Fluent.xaml&lt;/code&gt; inside &lt;code&gt;Styles.xaml&lt;/code&gt; makes the target a merged dictionary of &lt;code&gt;Styles.xaml&lt;/code&gt;, and the reference stops resolving.&lt;/p&gt;
&lt;h3&gt;
  
  
  Merge the dictionary from App.xaml
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;App.xaml&lt;/code&gt; is then limited to setting &lt;code&gt;ThemeMode&lt;/code&gt; and merging &lt;code&gt;Styles.xaml&lt;/code&gt;.&lt;br&gt;
Keeping the style itself out of &lt;code&gt;Application.Resources&lt;/code&gt; is the essential point.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Application&lt;/span&gt; &lt;span class="na"&gt;x:Class=&lt;/span&gt;&lt;span class="s"&gt;"MyApp.App"&lt;/span&gt;
             &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
             &lt;span class="na"&gt;xmlns:x=&lt;/span&gt;&lt;span class="s"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
             &lt;span class="na"&gt;StartupUri=&lt;/span&gt;&lt;span class="s"&gt;"MainWindow.xaml"&lt;/span&gt;
             &lt;span class="na"&gt;ThemeMode=&lt;/span&gt;&lt;span class="s"&gt;"Light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Application.Resources&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ResourceDictionary&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;ResourceDictionary&lt;/span&gt; &lt;span class="na"&gt;Source=&lt;/span&gt;&lt;span class="s"&gt;"pack://application:,,,/MyApp;component/Styles.xaml"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/ResourceDictionary&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Application.Resources&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Application&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Fluent dictionary merged by &lt;code&gt;ThemeMode&lt;/code&gt; and &lt;code&gt;Styles.xaml&lt;/code&gt; become sibling merged dictionaries within &lt;code&gt;Application.Resources&lt;/code&gt;.&lt;br&gt;
With this layout, &lt;code&gt;BasedOn&lt;/code&gt; resolves to the Fluent implicit style and only the &lt;code&gt;Padding&lt;/code&gt; setter is layered on top.&lt;br&gt;
In measurement, the Fluent dictionary added by &lt;code&gt;ThemeMode&lt;/code&gt; precedes &lt;code&gt;Styles.xaml&lt;/code&gt;, so the ordering issue described later does not arise.&lt;br&gt;
For a file in the same project whose build action is &lt;code&gt;Resource&lt;/code&gt;, a relative path such as &lt;code&gt;Source="Styles.xaml"&lt;/code&gt; also works.&lt;/p&gt;


  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs-iguchi09.github.io%2Fimages%2Farticles%2Fwpf-fluent-theme-custom-style-not-applied%2Fimplicit-style-basedon-fluent.png" alt="A WPF window with the Fluent theme applied. The Save button now has rounded corners and a light background in the Fluent appearance, matching the Overwrite check box below it." width="286" height="183"&gt;The state produced by applying the &lt;code&gt;Styles.xaml&lt;/code&gt; and &lt;code&gt;App.xaml&lt;/code&gt; above as written. Captured on Windows 11 / .NET 10 with &lt;code&gt;ThemeMode=Light&lt;/code&gt;. Compared with the previous figure, the &lt;code&gt;Button&lt;/code&gt; now has rounded corners and a lighter background. In measurement, the &lt;code&gt;Padding&lt;/code&gt; setter survives unchanged in this state.
  

&lt;h3&gt;
  
  
  Placement and resolution results
&lt;/h3&gt;

&lt;p&gt;Whether &lt;code&gt;BasedOn&lt;/code&gt; resolves depends on the combination of where the style lives and where Fluent comes from.&lt;br&gt;
The following results were measured for &lt;code&gt;Button&lt;/code&gt; on both .NET 9 and .NET 10.&lt;br&gt;
The &lt;code&gt;BasedOn&lt;/code&gt; column shows the key passed to &lt;code&gt;BasedOn="{StaticResource ...}"&lt;/code&gt;.&lt;br&gt;
For the row with &lt;code&gt;x:Key&lt;/code&gt;, the keyed style was applied explicitly through &lt;code&gt;Style="{StaticResource ...}"&lt;/code&gt;, with no implicit &lt;code&gt;{x:Type Button}&lt;/code&gt; style placed alongside it.&lt;br&gt;
The table covers only placements where the custom style actually applies to the control; for placements where the custom style never applies at all, see the notes below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Placement of the style&lt;/th&gt;
&lt;th&gt;Source of Fluent&lt;/th&gt;
&lt;th&gt;&lt;code&gt;BasedOn&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Directly in &lt;code&gt;Application.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;Legacy look&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Directly in &lt;code&gt;Application.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Legacy look (&lt;code&gt;BasedOn&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Directly in &lt;code&gt;Application.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DefaultButtonStyle&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fluent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Directly in &lt;code&gt;Application.Resources&lt;/code&gt; (with &lt;code&gt;x:Key&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fluent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Separate file merged into &lt;code&gt;Application.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fluent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Window.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fluent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Separate file merged into &lt;code&gt;Window.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fluent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;Window.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on the same &lt;code&gt;Window&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Legacy look (&lt;code&gt;BasedOn&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Separate file merged into &lt;code&gt;Window.Resources&lt;/code&gt; (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ThemeMode&lt;/code&gt; on the same &lt;code&gt;Window&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Legacy look (&lt;code&gt;BasedOn&lt;/code&gt; is not &lt;code&gt;null&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Separate file that merges &lt;code&gt;Fluent.xaml&lt;/code&gt; itself (implicit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Fluent.xaml&lt;/code&gt; in that same file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{x:Type Button}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Legacy look (&lt;code&gt;BasedOn&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each of the three rows where &lt;code&gt;BasedOn&lt;/code&gt; becomes &lt;code&gt;null&lt;/code&gt; meets the same condition: the key passed to &lt;code&gt;BasedOn&lt;/code&gt; matches the style's own key, and that key also exists in a dictionary merged into the dictionary declaring the style.&lt;br&gt;
The row referencing &lt;code&gt;DefaultButtonStyle&lt;/code&gt;, whose key differs, and the row whose style carries an &lt;code&gt;x:Key&lt;/code&gt; do not meet that condition, so they resolve even though they sit directly in &lt;code&gt;Application.Resources&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The row pairing a separate file merged into &lt;code&gt;Window.Resources&lt;/code&gt; with &lt;code&gt;ThemeMode&lt;/code&gt; on that same &lt;code&gt;Window&lt;/code&gt;, by contrast, keeps the legacy look without meeting the condition.&lt;br&gt;
The dictionary declaring the style in that row is the separate file, and Fluent sits outside it in the merged dictionaries of &lt;code&gt;Window.Resources&lt;/code&gt;, so the condition does not apply.&lt;br&gt;
Even so, &lt;code&gt;BasedOn&lt;/code&gt; was not &lt;code&gt;null&lt;/code&gt; in measurement; it resolved to the default theme style instead of Fluent.&lt;br&gt;
When &lt;code&gt;ThemeMode&lt;/code&gt; is set on a &lt;code&gt;Window&lt;/code&gt;, moving the style into a separate file is not enough.&lt;br&gt;
Moving &lt;code&gt;ThemeMode&lt;/code&gt; up to &lt;code&gt;Application&lt;/code&gt; resolves it.&lt;br&gt;
In measurement, both a style directly in &lt;code&gt;Window.Resources&lt;/code&gt; and one in a file merged into &lt;code&gt;Window.Resources&lt;/code&gt; reached Fluent that way.&lt;br&gt;
Moving the style into &lt;code&gt;Application.Resources&lt;/code&gt; itself is a separate matter, and the second row of the table shows that it does not resolve.&lt;/p&gt;
&lt;h3&gt;
  
  
  Alternative: when the App.xaml structure cannot change
&lt;/h3&gt;

&lt;p&gt;When the file layout is fixed, reference &lt;code&gt;DefaultButtonStyle&lt;/code&gt;, which the Fluent theme dictionary provides.&lt;br&gt;
Because that key differs from the style's own &lt;code&gt;{x:Type Button}&lt;/code&gt; key, it resolves even directly inside &lt;code&gt;Application.Resources&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Application.Resources&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Style&lt;/span&gt; &lt;span class="na"&gt;TargetType=&lt;/span&gt;&lt;span class="s"&gt;"Button"&lt;/span&gt; &lt;span class="na"&gt;BasedOn=&lt;/span&gt;&lt;span class="s"&gt;"{StaticResource DefaultButtonStyle}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Setter&lt;/span&gt; &lt;span class="na"&gt;Property=&lt;/span&gt;&lt;span class="s"&gt;"Padding"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"16,6"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Style&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Application.Resources&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Measurement shows that the Fluent &lt;code&gt;{x:Type Button}&lt;/code&gt; style carries no setter of its own and that its &lt;code&gt;BasedOn&lt;/code&gt; is &lt;code&gt;DefaultButtonStyle&lt;/code&gt; itself.&lt;br&gt;
For &lt;code&gt;Button&lt;/code&gt; the two are effectively equivalent, so this form loses no setter.&lt;br&gt;
&lt;code&gt;DefaultButtonStyle&lt;/code&gt; is not a documented key and depends on the internal structure of &lt;code&gt;Fluent.xaml&lt;/code&gt;, so treat it as a stopgap.&lt;br&gt;
Applying the same approach to another control requires checking that control's key name, and whether its implicit style is equivalent to the style under that key.&lt;br&gt;
In measurement the &lt;code&gt;TargetType&lt;/code&gt; of &lt;code&gt;DefaultButtonStyle&lt;/code&gt; is &lt;code&gt;ButtonBase&lt;/code&gt;, not &lt;code&gt;Button&lt;/code&gt;, so the referenced style may target a base type.&lt;/p&gt;
&lt;h3&gt;
  
  
  Alternative: confining the change to part of the UI
&lt;/h3&gt;

&lt;p&gt;A keyed style resolves &lt;code&gt;BasedOn&lt;/code&gt; against &lt;code&gt;{x:Type Button}&lt;/code&gt; even directly inside &lt;code&gt;Application.Resources&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Application.Resources&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;Style&lt;/span&gt; &lt;span class="na"&gt;x:Key=&lt;/span&gt;&lt;span class="s"&gt;"WideButton"&lt;/span&gt; &lt;span class="na"&gt;TargetType=&lt;/span&gt;&lt;span class="s"&gt;"Button"&lt;/span&gt;
         &lt;span class="na"&gt;BasedOn=&lt;/span&gt;&lt;span class="s"&gt;"{StaticResource {x:Type Button}}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Setter&lt;/span&gt; &lt;span class="na"&gt;Property=&lt;/span&gt;&lt;span class="s"&gt;"Padding"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"16,6"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/Style&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Application.Resources&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because this style does not occupy the &lt;code&gt;{x:Type Button}&lt;/code&gt; key itself, the target of the reference is the Fluent implicit style.&lt;br&gt;
A keyed style is not applied automatically, so every control needs an explicit &lt;code&gt;Style="{StaticResource WideButton}"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This form reaches Fluent only as long as no implicit &lt;code&gt;{x:Type Button}&lt;/code&gt; style remains directly in &lt;code&gt;Application.Resources&lt;/code&gt;.&lt;br&gt;
In measurement, keeping an implicit style alongside it made &lt;code&gt;BasedOn&lt;/code&gt; resolve to that implicit style instead, leaving the legacy appearance.&lt;br&gt;
A keyed style applied without &lt;code&gt;BasedOn&lt;/code&gt; also falls back to the legacy appearance, just as an implicit one does.&lt;/p&gt;




&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nothing reports the failure.&lt;/strong&gt; An unresolved &lt;code&gt;BasedOn&lt;/code&gt; produces no exception and no warning in the output window. Only the rendered appearance reveals it, so verify migrations visually against Fluent-specific traits such as rounded corners.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set &lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt;.&lt;/strong&gt; Setting it per window creates placements where &lt;code&gt;BasedOn&lt;/code&gt; resolves to the default theme style rather than Fluent, even with the style moved into a separate file. A separate problem also appears: with &lt;code&gt;ThemeMode&lt;/code&gt; on a &lt;code&gt;Window&lt;/code&gt; and the custom styles merged into &lt;code&gt;Application.Resources&lt;/code&gt;, the appearance does turn Fluent but the custom setters have no effect. The Fluent implicit style that &lt;code&gt;ThemeMode&lt;/code&gt; placed in &lt;code&gt;Window.Resources&lt;/code&gt; is found before the custom style in the outer &lt;code&gt;Application.Resources&lt;/code&gt;, so the custom style never applies. Unless individual windows need different light/dark modes, keep the setting on &lt;code&gt;Application&lt;/code&gt;. Note that once &lt;code&gt;Application&lt;/code&gt; carries anything other than &lt;code&gt;None&lt;/code&gt;, a &lt;code&gt;Window&lt;/code&gt; can no longer be set back to &lt;code&gt;None&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Each control type needs its own fix.&lt;/strong&gt; Implicit style keys are per type, so repairing &lt;code&gt;Button&lt;/code&gt; leaves the styles of &lt;code&gt;TextBox&lt;/code&gt; or &lt;code&gt;CheckBox&lt;/code&gt; untouched. Enumerate the declared styles by type before migrating an existing application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The set of controls Fluent covers differs by version.&lt;/strong&gt; &lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/whats-new/net100#fluent-style-changes" rel="noopener noreferrer"&gt;What's new in WPF for .NET 10&lt;/a&gt; added styles for controls such as &lt;code&gt;GroupBox&lt;/code&gt;. Measurement confirms that the implicit style for &lt;code&gt;GroupBox&lt;/code&gt; is absent from Fluent on .NET 9 and present on .NET 10. For a control that Fluent does not style implicitly, &lt;code&gt;BasedOn&lt;/code&gt; resolves to the default theme style instead of becoming &lt;code&gt;null&lt;/code&gt;, so a &lt;code&gt;null&lt;/code&gt; check does not catch it; judge by the unchanged appearance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Style="{x:Null}"&lt;/code&gt; opts out of Fluent.&lt;/strong&gt; Disabling style application leaves that control with the Aero2 appearance. Review any place that uses &lt;code&gt;{x:Null}&lt;/code&gt; to restore a default look before adopting Fluent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When using &lt;code&gt;ThemeMode&lt;/code&gt;, do not merge the Fluent theme dictionaries by hand.&lt;/strong&gt; The reference for the &lt;a href="https://learn.microsoft.com/dotnet/api/system.windows.application.thememode" rel="noopener noreferrer"&gt;&lt;code&gt;Application.ThemeMode&lt;/code&gt; property&lt;/a&gt; recommends against adding the Fluent theme dictionaries manually when the property is set, because the manually added ones take precedence. The same reference notes that &lt;code&gt;ThemeMode&lt;/code&gt; also controls the window backdrop and dark mode, so it is not equivalent to merging &lt;code&gt;Fluent.xaml&lt;/code&gt; by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The order of merged dictionaries changes the result.&lt;/strong&gt; As the article on &lt;a href="https://learn.microsoft.com/dotnet/desktop/wpf/systems/xaml-resources-merged-dictionaries" rel="noopener noreferrer"&gt;merged resource dictionaries&lt;/a&gt; states, when the same key appears twice in one &lt;code&gt;MergedDictionaries&lt;/code&gt;, the later entry wins. In measurement, merging &lt;code&gt;Fluent.xaml&lt;/code&gt; after the custom styles discarded the custom setters. Place &lt;code&gt;Fluent.xaml&lt;/code&gt; before the custom styles when merging it manually.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A direct &lt;code&gt;Fluent.xaml&lt;/code&gt; merge follows the Windows theme setting.&lt;/strong&gt; In measurement, merging &lt;code&gt;Fluent.xaml&lt;/code&gt; on a machine set to dark mode loaded the dark dictionary at startup. Whether it follows a theme switch made while the application is running was not verified for this article. To pin the appearance, drop the manual merge and set &lt;code&gt;ThemeMode&lt;/code&gt; to &lt;code&gt;Light&lt;/code&gt; or &lt;code&gt;Dark&lt;/code&gt;. Adding &lt;code&gt;ThemeMode&lt;/code&gt; while keeping the manual merge leaves the control colors unpinned, because the manual merge wins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ThemeMode&lt;/code&gt; and Fluent are still changing.&lt;/strong&gt; &lt;code&gt;ThemeMode&lt;/code&gt; remains an experimental API as of .NET 10, and its reference notes that it may be removed in a future version. The Fluent style implementation is also still in progress. The results table above reflects .NET 9 and .NET 10, and later versions warrant a recheck.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Alternatives / Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Pros&lt;/th&gt;
&lt;th&gt;Cons&lt;/th&gt;
&lt;th&gt;Best suited for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Separate dictionary with &lt;code&gt;BasedOn="{StaticResource {x:Type Button}}"&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Relies only on documented markup, and implicit styles keep applying automatically&lt;/td&gt;
&lt;td&gt;Requires changing the file layout&lt;/td&gt;
&lt;td&gt;The standard case of migrating an existing app to Fluent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;BasedOn="{StaticResource DefaultButtonStyle}"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Leaves the &lt;code&gt;App.xaml&lt;/code&gt; structure untouched&lt;/td&gt;
&lt;td&gt;Depends on a key that is not documented&lt;/td&gt;
&lt;td&gt;A stopgap when the file layout cannot change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keyed style applied explicitly with &lt;code&gt;BasedOn&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Limits the scope of the change to the chosen controls&lt;/td&gt;
&lt;td&gt;Every usage needs an explicit &lt;code&gt;Style&lt;/code&gt; reference&lt;/td&gt;
&lt;td&gt;Adjusting only certain screens or controls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Keep the existing styles without Fluent&lt;/td&gt;
&lt;td&gt;No migration work&lt;/td&gt;
&lt;td&gt;Loses the Windows 11 appearance and does not follow the light/dark theme&lt;/td&gt;
&lt;td&gt;Applications that already ship a fully custom design&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;As far as style delivery is concerned, the Fluent theme arrives as implicit styles inside a resource dictionary rather than as a theme style.&lt;br&gt;
An application style using the same &lt;code&gt;{x:Type Button}&lt;/code&gt; key therefore hides the Fluent style, and the control falls back to the Aero2 appearance.&lt;/p&gt;

&lt;p&gt;The fix is inheritance through &lt;code&gt;BasedOn="{StaticResource {x:Type Button}}"&lt;/code&gt;, but when the key passed to &lt;code&gt;BasedOn&lt;/code&gt; matches the style's own key and also exists in a dictionary merged into the dictionary declaring the style, &lt;code&gt;BasedOn&lt;/code&gt; stays unresolved and the legacy look remains with no error to signal it.&lt;br&gt;
For migrating an existing application, set &lt;code&gt;ThemeMode&lt;/code&gt; on &lt;code&gt;Application&lt;/code&gt; and make the default structure a dedicated resource dictionary file holding the styles, merged from &lt;code&gt;App.xaml&lt;/code&gt;.&lt;br&gt;
Setting &lt;code&gt;ThemeMode&lt;/code&gt; per window creates placements where the style is never chained to Fluent, even when it lives in a separate file.&lt;br&gt;
Reference &lt;code&gt;DefaultButtonStyle&lt;/code&gt; only when the &lt;code&gt;App.xaml&lt;/code&gt; structure cannot be changed, and choose keyed styles with explicit application when the change should stay confined to part of the UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  Related Articles
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://s-iguchi09.github.io/articles/wpf-fluent-design-with-systemcolors/" rel="noopener noreferrer"&gt;Applying Fluent Design in WPF Without Extra Libraries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://s-iguchi09.github.io/articles/wpf-fluent-textbox-hide-clear-button/" rel="noopener noreferrer"&gt;Hiding the Clear Button on a Fluent-Themed WPF TextBox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://s-iguchi09.github.io/articles/wpf-staticresource-vs-dynamicresource/" rel="noopener noreferrer"&gt;Why StaticResource Changes Are Not Reflected in WPF and How to Fix It&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://s-iguchi09.github.io/articles/csharp-natural-sort-strcmplogicalw-icomparer/" rel="noopener noreferrer"&gt;Replicating Windows Explorer Sort Order in C# with StrCmpLogicalW and IComparer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>wpf</category>
      <category>dotnet</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
