Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're pretty much there. You can always apply a semi-transparent colour on top of your picture below your text/content but since you asked for changing the entire image, here's what you can do:</p> <p>In Visual Studio 2012, if you already have a button mostly styled/configured to what you want, right click it, Edit Template -> Edit a Copy. Choose where you want to put the new style/template. It's like picking where to put the CSS. Could be in a global file (App.xaml or StandardStyle.xaml) or in the header (page resources) or inline (control resources). </p> <p>The below XAML might be over-simplified and not work but it's the idea of it:</p> <pre><code>&lt;ControlTemplate x:Key="MyButton" TargetType="Button"&gt; &lt;Grid&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="CommonStates"&gt; &lt;VisualState x:Name="Normal" /&gt; &lt;VisualState x:Name="PointerOver"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="Visibility"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="Pressed"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedBackground" Storyboard.TargetProperty="Visibility"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Visible" /&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; [...] &lt;/VisualStateGroup&gt; &lt;VisualStateGroup x:Name="FocusStates"&gt; [...] &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;Border x:Name="Border" [...]&gt; &lt;Grid&gt; &lt;Image Source="[...]" Stretch="None" /&gt; &lt;Image x:Name="HoverBackground" Source="[...]" Visibility="Collapsed" /&gt; &lt;Image x:Name="PressedBackground" Source="[...]" Visibility="Collapsed" /&gt; &lt;ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTransitions="{TemplateBinding ContentTransitions}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" [...]/&gt; &lt;/Grid&gt; &lt;/Border&gt; [...] &lt;/Grid&gt; &lt;/ControlTemplate&gt; </code></pre> <p>Now you can place your 3 images in the 3 <code>&lt;Image&gt;</code> tags and since the ContentPresenter is on top, when you use the template with <code>&lt;Button Template="{StaticResource MyButton}"&gt;</code>, you can still put content in and it will appear on top of your background image. Or you can just have a fully graphical button with the images too.</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.
    1. VO
      singulars
      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