<mah:MetroWindow x:Class="FFXIV_TexTools.Views.Models.FullModelView"
                      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:FFXIV_TexTools.Views.Models"
                      xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
                      xmlns:views="clr-namespace:FFXIV_TexTools.Views"
                      mc:Ignorable="d"
                      xmlns:resx="clr-namespace:FFXIV_TexTools.Resources"
                      resx:Localization.Enabled="True"                     
                      Title="Full Model Viewer" Height="800" Width="550" Closing="MetroWindow_Closing">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <ComboBox Grid.Column="0" VerticalAlignment="Center" Margin="5" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="{Binding Source={x:Static resx:UIStrings.Skeleton}}" 
                      ItemsSource="{Binding Path=Skeletons}" DisplayMemberPath="Name" SelectedValuePath="XivRace" SelectedItem="{Binding Path=SelectedSkeleton}" SelectedIndex="{Binding SelectedSkeletonIndex}"
                      IsEnabled="{Binding Path=SkeletonComboboxEnabled}" />
            <ComboBox Grid.Column="1" VerticalAlignment="Center" Margin="5" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="{Binding Source={x:Static resx:UIStrings.Skin}}" 
                      ItemsSource="{Binding Path=Skins}" SelectedItem="{Binding Path=SelectedSkin}" SelectedIndex="{Binding Path=SelectedSkinIndex}" IsEnabled="{Binding SkinComboboxEnabled}" />
            <ComboBox Grid.Column="2" VerticalAlignment="Center" Margin="5" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="{Binding Source={x:Static resx:UIStrings.Face}}" 
                      ItemsSource="{Binding Path=Faces}" SelectedItem="{Binding Path=SelectedFace}" SelectedIndex="{Binding Path=SelectedFaceIndex}" IsEnabled="{Binding Path=FaceComboboxEnabled}" Visibility="{Binding Path=FaceComboboxVisibility, FallbackValue=Collapsed}"/>
        </Grid>
        <Grid Grid.Row="1">
            <Grid>
                <hx:Viewport3DX
                x:Name="viewport3DX"
                DataContext="{Binding Path=ViewportVM}"
                Camera="{Binding Path=Camera}"
                CoordinateSystemLabelForeground="White"
                TextBrush="Black"
                UseDefaultGestures="False"
                BackgroundColor="{Binding Path=BackgroundColor}"
                EffectsManager="{Binding Path=EffectsManager}"
                IsZoomEnabled="True"
                ZoomExtentsWhenLoaded="True" 
                ShowTriangleCountInfo="True" FXAALevel="Medium" MSAA="Two" 
                OITRenderMode="DepthPeeling" OITWeightMode="Linear0" ZoomDistanceLimitNear="0.0001">
                    <hx:Viewport3DX.InputBindings>
                        <KeyBinding Key="B" Command="hx:ViewportCommands.BackView" />
                        <KeyBinding Key="F" Command="hx:ViewportCommands.FrontView" />
                        <KeyBinding Key="U" Command="hx:ViewportCommands.TopView" />
                        <KeyBinding Key="D" Command="hx:ViewportCommands.BottomView" />
                        <KeyBinding Key="L" Command="hx:ViewportCommands.LeftView" />
                        <KeyBinding Key="R" Command="hx:ViewportCommands.RightView" />
                        <KeyBinding Command="hx:ViewportCommands.ZoomExtents" Gesture="Alt+E" />
                        <KeyBinding Command="hx:ViewportCommands.Reset" Gesture="Alt+R"/>
                        <MouseBinding Command="hx:ViewportCommands.Rotate" Gesture="RightClick" />
                        <MouseBinding Command="hx:ViewportCommands.Zoom" Gesture="MiddleClick" />
                        <MouseBinding Command="hx:ViewportCommands.Pan" Gesture="LeftClick" />
                    </hx:Viewport3DX.InputBindings>

                    <hx:DirectionalLight3D
                    Direction="{Binding Path=Light1Direction}"
                    Color="{Binding Path=Light1Color}" />
                    <hx:DirectionalLight3D
                    Direction="{Binding Path=Light2Direction}"
                    Color="{Binding Path=Light2Color}" />
                    <hx:DirectionalLight3D
                    Direction="{Binding Path=Light3Direction}"
                    Color="{Binding Path=Light3Color}" />

                    <hx:GroupModel3D ItemsSource="{Binding Path=Models}"/>
                </hx:Viewport3DX>
                <Canvas Name="AlternateViewportCanvas" Visibility="Hidden" IsHitTestVisible="False"/>
            </Grid>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5">
                <Button x:Name="ViewerOptionsButton" Content="{Binding Source={x:Static resx:UIStrings.Viewer_Options}}" Command="{Binding Path=ViewOptionsCommand}"/>
            </StackPanel>
        </Grid>
        <mah:FlyoutsControl Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Right">
            <mah:Flyout x:Name="ViewerOptionsFlyout" 
                        Header="Viewer Options" 
                        Position="Right" 
                        Width="250" 
                        HorizontalContentAlignment="Stretch" 
                        VerticalContentAlignment="Stretch"
                        DataContext="{Binding Path=ViewportVM}">
                <views:ModelViewerOptionsView/>
            </mah:Flyout>
        </mah:FlyoutsControl>

        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <ComboBox VerticalAlignment="Center" Margin="5,0" mah:TextBoxHelper.UseFloatingWatermark="True" mah:TextBoxHelper.Watermark="{Binding Source={x:Static resx:UIStrings.Model}}" 
                      ItemsSource="{Binding Path=ModelList}" SelectedIndex="{Binding Path=SelectedModelIndex}" DisplayMemberPath="Key" SelectedValuePath="Value" />
            <Button Grid.Column="1" x:Name="RemoveButton" Content="{Binding Source={x:Static resx:UIStrings.Remove}}" Command="{Binding Path=RemoveCommand}" IsEnabled="{Binding Path=RemoveEnabled}" Margin="5"/>
        </Grid>

        <Button Grid.Row="3" x:Name="ExportModelButton" Content="{Binding Source={x:Static resx:UIStrings.Export}}" Margin="5" VerticalAlignment="Center" Click="ExportModelButton_Click" IsEnabled="{Binding Path=ExportEnabled, FallbackValue=false}"/>

    </Grid>
</mah:MetroWindow>
