1

I have this button

<Button
    Width="120"
    Height="60"
    HorizontalAlignment="Left"
    Command="{Binding OpenTimerSettingsWindowCommand}"
    Style="{StaticResourceGreyButtonStyle}">
        <StackPanel 
            Orientation="Horizontal">
            <Rectangle 
                Width="25" 
                Height="25">
                <Rectangle.Fill>
                    <VisualBrushStretch="Uniform"
                        Visual="{StaticResource appbar_timer}"/>
                </Rectangle.Fill>
            </Rectangle>
            <TextBlock 
                Margin="5,0,0,0"
                VerticalAlignment="Center"
                FontSize="14"
                Foreground="White"
                Text="Timers"/>
        </StackPanel>
</Button>

I actually have alot of buttons like this - but with one two small exceptions; The command and the "Visual" inside the rectangle.

My Question:

Is there a way to specify this once in app.xaml and bind Visual in my window.xaml? or do I need to paste this, every time I have a button? I'm leaning towards creating my own control - but I'm wondering if a datatemplate can be created for this

VisualBean
  • 4,908
  • 2
  • 28
  • 57
  • See my previous [`answer`](http://stackoverflow.com/questions/17630968/wpf-c-sharp-button-style/17639062#17639062), may be help. For setting different image create your *attached* dependency property and bind it in Template. – Anatoliy Nikolaev Mar 25 '14 at 11:33

0 Answers0