<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:widget="clr-namespace:BallanceTasEditor.Frontend.Widgets">

    <Style x:Key="IconButtonStyle" TargetType="{x:Type widget:IconButton}" BasedOn="{StaticResource {x:Type Button}}">
        <!--
        YYC MARK:
        I was forced to use ContentTemplate to implement this.
        If I directly set Content, it will trigger weird image reuse issue,
        which cause only one IconButton can be displayed correctly.
        -->
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding ButtonIcon, RelativeSource={RelativeSource AncestorType=widget:IconButton}, Mode=OneWay}" 
                               RenderOptions.BitmapScalingMode="HighQuality"
                               Width="16" Height="16" VerticalAlignment="Center"/>
                        <TextBlock Text="{Binding ButtonText, RelativeSource={RelativeSource AncestorType=widget:IconButton}, Mode=OneWay}" 
                                   Margin="5,0,0,0" VerticalAlignment="Center"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type widget:IconButton}" BasedOn="{StaticResource IconButtonStyle}"/>

    <Style x:Key="OkIconButtonStyle" TargetType="{x:Type widget:IconButton}" BasedOn="{StaticResource IconButtonStyle}">
        <Setter Property="Padding" Value="5"/>
        <Setter Property="MinWidth" Value="80"/>
        <Setter Property="ButtonIcon" Value="/Frontend/Assets/Ok.ico"/>
        <Setter Property="ButtonText" Value="OK"/>
    </Style>

    <Style x:Key="CancelIconButtonStyle" TargetType="{x:Type widget:IconButton}" BasedOn="{StaticResource IconButtonStyle}">
        <Setter Property="Padding" Value="5"/>
        <Setter Property="MinWidth" Value="80"/>
        <Setter Property="ButtonIcon" Value="/Frontend/Assets/Cancel.ico"/>
        <Setter Property="ButtonText" Value="Cancel"/>
    </Style>

</ResourceDictionary>