<Window x:Class="DatabaseEditor.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:views="clr-namespace:DatabaseEditor.Views"
        mc:Ignorable="d"
        DataContext="{Binding MainViewModel, Source={StaticResource ViewModelLocator}}"
        d:DesignHeight="300" d:DesignWidth="400">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Menu IsMainMenu="True">
            <MenuItem>
                <MenuItem.Style>
                    <Style TargetType="MenuItem">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsConnected}" Value="True">
                                <Setter Property="Header" Value="Disconnect" />
                                <Setter Property="Command" Value="{Binding DisconnectCommand}" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsConnected}" Value="False">
                                <Setter Property="Header" Value="Connect" />
                                <Setter Property="Command" Value="{Binding ConnectCommand}" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </MenuItem.Style>
            </MenuItem>
            <MenuItem Header="Refresh" Command="{Binding RefreshCommand}" />
        </Menu>
        <TabControl Grid.Row="1" SelectedIndex="{Binding TabSelectionIndex, Mode=TwoWay}">
            <TabItem Header="Books">
                <views:BooksPageView x:Name="BooksView" />
            </TabItem>
            <TabItem Header="Authors">
                <views:AuthorsPageView x:Name="AuthorsView" />
            </TabItem>
        </TabControl>
        <views:CreateDatabaseDialogView Grid.Row="0" Grid.RowSpan="2"
                                        Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=views:MainWindow}, Path=DataContext.CreateDatabaseDialogVisible, Converter={StaticResource BooltoVis}}" />
    </Grid>
</Window>