<Window x:Class="WPFCustomMessageBox.CustomMessageBoxWindow"
        x:ClassModifier="internal"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        WindowStartupLocation="CenterScreen"
        WindowStyle="None"
        ResizeMode="NoResize" SizeToContent="WidthAndHeight"
        TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="ClearType" UseLayoutRounding="True"
        Title="" MinHeight="155" MaxWidth="470" MinWidth="154"
        BorderBrush="DarkGray" BorderThickness="2">

    <WindowChrome.WindowChrome>
        <WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
    </WindowChrome.WindowChrome>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" Margin="0,10,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="25"/>
                <ColumnDefinition Width="115"/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition Width="50"/>
            </Grid.ColumnDefinitions>

            <Image Grid.Column="0" Source="/Images/Icon.ico" Height="20" Width="20" Margin="1" />
            <Label Grid.Column="1" Grid.ColumnSpan="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" MouseDown="TitleMouseDown" Content="{Binding Path=Title,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"/>
        </Grid>

        <!-- Make the window width fit the title by embedding the title invisibly  -->
        <TextBlock Text="{Binding Path=Title,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
                   Visibility="Hidden" Height="0" Margin="50 0 0 0" />

        <Grid Grid.Row="1" Background="{DynamicResource CustomMessageBox.Static.Background}" MinHeight="69">
            <DockPanel>
                <Image Name="Image_MessageBox" Width="32" Height="32" HorizontalAlignment="Left" DockPanel.Dock="Left" Margin="30,0,0,0" Visibility="Collapsed"/>
                <TextBlock Name="TextBlock_Message" TextWrapping="Wrap" MaxWidth="500" Width="Auto"
                       VerticalAlignment="Center" Margin="12,20,41,15" />
            </DockPanel>
        </Grid>
        
        <Grid Grid.Row="2" Background="{DynamicResource CustomMessageBox.Static.Background}" MinHeight="49">
            <DockPanel Margin="5,0">
                
                <!-- Cancel Button -->
                <Button Name="Button_Cancel" MinWidth="88" MaxWidth="160" Height="26" Margin="5,0" HorizontalAlignment="Right" Visibility="Collapsed" IsCancel="True"
                        DockPanel.Dock="Right" Click="Button_Cancel_Click" Style="{DynamicResource CustomButtonStyle}">
                    <Label Name="Label_Cancel" Padding="0" Margin="10,0">_Cancel</Label>
                </Button>
                <!-- End Cancel Button -->
                
                <!-- No Button -->
                <Button Name="Button_No" MinWidth="88" MaxWidth="160" Height="26" Margin="5,0" HorizontalAlignment="Right" Visibility="Collapsed"
                        DockPanel.Dock="Right" Click="Button_No_Click" Style="{DynamicResource CustomButtonStyle}">
                    <Label Name="Label_No" Padding="0" Margin="10,0">_No</Label>
                </Button>
                <!-- End No Button -->
                
                <!-- Yes Button -->
                <Button Name="Button_Yes" MinWidth="88" MaxWidth="160" Height="26" Margin="35,0,5,0" HorizontalAlignment="Right" Visibility="Collapsed"
                        DockPanel.Dock="Right" Click="Button_Yes_Click" Style="{DynamicResource CustomButtonStyle}">
                    <Label Name="Label_Yes" Padding="0" Margin="10,0">_Yes</Label>
                </Button>
                <!-- End Yes Button -->
                
                <!-- OK Button -->
                <Button Name="Button_OK" MinWidth="88" MaxWidth="160" Margin="35,0,5,0" HorizontalAlignment="Right" Height="26"
                        Click="Button_OK_Click" Style="{DynamicResource CustomButtonStyle}">
                    <Label Name="Label_Ok" Padding="0" Margin="10,0">_OK</Label>
                </Button>
                <!-- End OK Button -->
                
            </DockPanel>
        </Grid>
    </Grid>
</Window>
