Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would suggest that you are trying too hard. All you need to do is to change the Style on the Window itself. Leave the dictionaries alone. :-)</p> <p>Here is an example that changes a windows style when you click from the list of available styles.</p> <p><img src="https://i.stack.imgur.com/OECCn.png" alt="How to style"></p> <p>My command boils down to </p> <pre><code> //Here I am changing the style on the window NewWindow.Style = ((StyleDetailsViewModel)x).Style; NewWindow.Show(); </code></pre> <p>with various input data</p> <pre><code> public StylingViewModel(Func&lt;string, Style&gt; findStyle) { Styles = new StyleDetailsViewModel[] { new StyleDetailsViewModel { Name = "None", Description = "Completely remove all styling and show the raw NavigationWindow including default navigation elements", WindowStyleNone = false, Image = "\\Resources\\WindowStyleNone.png" }, new StyleDetailsViewModel { Name = "PlainWindow", Style = findStyle("PlainWindow"), Description = "Hides the navigation elemetns of the NavigationWindow to make it look just like a normal window", WindowStyleNone = false, Image = "\\Resources\\WindowStylePlain.png" }, new StyleDetailsViewModel { Name = "Windows 7", Style = findStyle("Win7NavigationWindow"), Description = "Uses glass effects to create a window that looks almost identical to the control panel from Windows 7.", WindowStyleNone = false, Image = "\\Resources\\WindowStyleWin7Nav.png" }, </code></pre> <p>and </p> <pre><code> this.DataContext = new StylingViewModel(x =&gt; (Style)this.FindResource(x)); </code></pre> <p>Also beware of certain Window properties that can only be set before the window opens, such as <code>WindowStyle="None"</code> which you need if you are doing custom chrome. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload