Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way for a WPF page to keep its style when in a Frame?
    text
    copied!<p>I have a WPF page that I've styled like this:</p> <p><img src="https://i.stack.imgur.com/7Zwgy.png" alt="WPF Page Example"></p> <p>When I set the source to the WPF page, it looks like it loads. However, the hatched background style disappears.</p> <p><img src="https://i.stack.imgur.com/piW24.png" alt="WPF Page In Frame Example"></p> <p>The button is just a test on the main Window. The background remains from the Window and the Page background isn't inherited.</p> <p>Any ideas?</p> <p>Frame:</p> <pre><code>&lt;Frame Source="{Binding ProductFrameSource}" Name="frameProducts" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Column="0" Grid.RowSpan="2" /&gt; private Uri _ProductFrameSource = new Uri("pack://application:,,,/&lt;omitted&gt;.&lt;omitted&gt;.UI;component/Views/Products/&lt;omitted&gt;/Products_&lt;omitted&gt;.xaml"); /// &lt;summary&gt; /// Gets or sets a property indicating the current product page to display /// &lt;/summary&gt; public Uri ProductFrameSource { get { return _ProductFrameSource; } set { _ProductFrameSource = value; RaisePropertyChanged("ProductFrameSource"); } } </code></pre> <p>Page Style:</p> <pre><code>&lt;Style TargetType="{x:Type Page}"&gt; &lt;Setter Property="Background"&gt; &lt;Setter.Value&gt; &lt;DrawingBrush TileMode="Tile" Viewport="0 0 40 40" ViewportUnits="Absolute" Viewbox="0 0 100 100" ViewboxUnits="Absolute"&gt; &lt;DrawingBrush.Drawing&gt; &lt;DrawingGroup&gt; &lt;GeometryDrawing Brush="#FF1C1C1C" Geometry="M 0 0 L 100 0 L 100 100 L 0 100 Z" /&gt; &lt;GeometryDrawing Geometry="M -10 77.5 L 22.5 110 M -10 52.5 L 47.5 110 M -10 27.5 L 72.5 110 M -10 2.5 L 97.5 110 M 2.5 -10 L 110 97.5 M 27.5 -10 L 110 72.5 M 52.5 -10 L 110 47.5 M 77.5 -10 L 110 22.5"&gt; &lt;GeometryDrawing.Pen&gt; &lt;Pen Brush="#FF908B91" Thickness=".5" /&gt; &lt;/GeometryDrawing.Pen&gt; &lt;/GeometryDrawing&gt; &lt;/DrawingGroup&gt; &lt;/DrawingBrush.Drawing&gt; &lt;/DrawingBrush&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
 

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