Note that there are some explanatory texts on larger screens.

plurals
  1. POOverriding Border style in a new window previously defined in Application Resources (possibly bug?)
    primarykey
    data
    text
    <p>I've written a small test case for some behavior that I don't quite understand. If someone could clear this up for me, I'd be most interested.</p> <p>I have, in App.xaml, </p> <pre><code>&lt;Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"&gt; &lt;Application.Resources&gt; &lt;Style TargetType="Border"&gt; &lt;Setter Property="BorderBrush" Value="Crimson" /&gt; &lt;/Style&gt; &lt;/Application.Resources&gt; &lt;/Application&gt; </code></pre> <p>I would like to remove the style for the following window so I redefine the style as seen in the following: -</p> <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"&gt; &lt;ListView&gt; &lt;ListView.Resources&gt; &lt;Style TargetType="Border" /&gt; &lt;/ListView.Resources&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn Header="test1" /&gt; &lt;GridViewColumn Header="test2" /&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; &lt;/Window&gt; </code></pre> <p>I was under the impression that if I were to redefine the style, as above, this would override what I put in the Application resources. I have tested with setting the border brush to no avail even though this shouldn't be required.</p> <p>Below is a screen capture of the window for which I had assumed there be no border styling: -</p> <p><img src="https://i.stack.imgur.com/dMh4D.png" alt="Test case window"></p> <p><strong>Note</strong> It seems to look fine in the designer but not at runtime. Furthermore this works for other target types EXCEPT border (Tested with TextBlock and a few other controls)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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