<base:WpfUiWindow
    x:Class="Bloxstrap.UI.Elements.Editor.BootstrapperEditorWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
    xmlns:base="clr-namespace:Bloxstrap.UI.Elements.Base"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:dmodels="clr-namespace:Bloxstrap.UI.ViewModels.Editor"
    xmlns:local="clr-namespace:Bloxstrap.UI.Elements.Editor"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
    Title="{Binding Path=Title, Mode=OneTime}"
    Width="1000"
    Height="500"
    d:DataContext="{d:DesignInstance dmodels:BootstrapperEditorWindowViewModel,
                                     IsDesignTimeCreatable=True}"
    Background="{ui:ThemeResource ApplicationBackgroundBrush}"
    ExtendsContentIntoTitleBar="True"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ui:TitleBar
            x:Name="RootTitleBar"
            Title="{Binding Path=Title, Mode=OneTime}"
            Grid.Row="0"
            Padding="8"
            ForceShutdown="False"
            Icon="pack://application:,,,/Bloxstrap.ico"
            MinimizeToTray="False"
            UseSnapLayout="True" />

        <avalonedit:TextEditor
            x:Name="UIXML"
            Grid.Row="1"
            Margin="10,10,10,0"
            ShowLineNumbers="True"
            SyntaxHighlighting="XML"
            TextChanged="OnCodeChanged" />

        <Grid
            Grid.Row="2"
            Margin="10"
            HorizontalAlignment="Center">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <ui:Button
                Grid.Column="0"
                Margin="0,0,5,0"
                HorizontalAlignment="Center"
                Command="{Binding Path=PreviewCommand, Mode=OneTime}"
                Content="Preview" />

            <ui:Button
                Grid.Column="1"
                Margin="5,0,0,0"
                HorizontalAlignment="Center"
                Command="{Binding Path=SaveCommand, Mode=OneTime}"
                Content="Save" />
        </Grid>
    </Grid>
</base:WpfUiWindow>
