<Window x:Class="CefFlashBrowser.Views.Dialogs.TextEditorDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CefFlashBrowser.Views.Dialogs"
        xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
        xmlns:behaviors="clr-namespace:CefFlashBrowser.Views.Behaviors"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        mc:Ignorable="d"
        
        x:Name="window"
        Height="250"
        Width="400"
        WindowStartupLocation="CenterOwner"
        FocusManager.FocusedElement="{Binding ElementName=inputTextBox}">

    <Window.InputBindings>
        <KeyBinding Gesture="Ctrl+W"
                    Command="{Binding ElementName=windowBehavior, Path=CloseWindowCommand}"/>
        <KeyBinding Gesture="Esc"
                    Command="{Binding ElementName=windowBehavior, Path=SetDialogResultCommand}">
            <KeyBinding.CommandParameter>
                <sys:Boolean>False</sys:Boolean>
            </KeyBinding.CommandParameter>
        </KeyBinding>
        <KeyBinding Gesture="Enter"
                    Command="{Binding ElementName=windowBehavior, Path=SetDialogResultCommand}">
            <KeyBinding.CommandParameter>
                <sys:Boolean>True</sys:Boolean>
            </KeyBinding.CommandParameter>
        </KeyBinding>
        <KeyBinding Gesture="Ctrl+Enter"
                    Command="{Binding ElementName=windowBehavior, Path=SetDialogResultCommand}">
            <KeyBinding.CommandParameter>
                <sys:Boolean>True</sys:Boolean>
            </KeyBinding.CommandParameter>
        </KeyBinding>
    </Window.InputBindings>

    <i:Interaction.Behaviors>
        <behaviors:WindowBehavior x:Name="windowBehavior"/>
    </i:Interaction.Behaviors>

    <DockPanel>
        <StackPanel DockPanel.Dock="Bottom"
                    Margin="10,0,10,10"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button MinWidth="70"
                    Content="{DynamicResource dialog_cancel}"
                    Command="{Binding ElementName=windowBehavior, Path=SetDialogResultCommand}">
                <Button.CommandParameter>
                    <sys:Boolean>False</sys:Boolean>
                </Button.CommandParameter>
            </Button>
            <Button Margin="10,0,0,0"
                    MinWidth="70"
                    Content="{DynamicResource dialog_ok}"
                    Style="{StaticResource ButtonPrimary}"
                    Command="{Binding ElementName=windowBehavior, Path=SetDialogResultCommand}">
                <Button.CommandParameter>
                    <sys:Boolean>True</sys:Boolean>
                </Button.CommandParameter>
            </Button>
        </StackPanel>

        <TextBox x:Name="inputTextBox"
                 Margin="10"
                 Padding="8"
                 TextWrapping="Wrap"
                 AcceptsReturn="True"
                 VerticalContentAlignment="Top"
                 VerticalScrollBarVisibility="Auto"
                 Text="{Binding ElementName=window, Path=Text}"/>
    </DockPanel>
</Window>
