Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>JWendel,</p> <p>You should post some examples of your XAML icons to clarify, but any content control, like <strong>Button</strong>'s and <strong>ContentControl</strong>'s, have both <strong>Content</strong>, and <strong>ContentTemplate</strong> properties. A shared <strong>ContentTemplate</strong> example is shown below:</p> <pre><code>&lt;UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" &gt; &lt;UserControl.Resources&gt; &lt;Style x:Key="MyTriangleIcon" TargetType="ContentControl"&gt; &lt;Setter Property="ContentTemplate"&gt; &lt;Setter.Value&gt; &lt;DataTemplate&gt; &lt;Grid&gt; &lt;Polygon Fill="Black" Stroke="Black"&gt; &lt;Polygon.Points&gt; &lt;Point X="0" Y="100"/&gt; &lt;Point X="100" Y="0"/&gt; &lt;Point X="100" Y="100"/&gt; &lt;/Polygon.Points&gt; &lt;/Polygon&gt; &lt;Polygon Fill="Red" Stroke="Red"&gt; &lt;Polygon.Points&gt; &lt;Point X="100" Y="0"/&gt; &lt;Point X="0" Y="100"/&gt; &lt;Point X="0" Y="0"/&gt; &lt;/Polygon.Points&gt; &lt;/Polygon&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/UserControl.Resources&gt; &lt;StackPanel Background="White"&gt; &lt;Button Width="120" Height="120" Style="{StaticResource MyTriangleIcon}" /&gt; &lt;Button Width="120" Height="120" Style="{StaticResource MyTriangleIcon}" /&gt; &lt;/StackPanel&gt; &lt;/UserControl&gt; </code></pre> <p>You can paste the above content into my <strong><a href="http://facetofacesoftware.com/XamlViewer/" rel="noreferrer" title="XamlViewer">XamlViewer</a></strong> to quickly see the results.</p> <p>Good luck,<br> Jim McCurdy</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