<UserControl x:Class="VIZ.Package.Module.MainTopView"
             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:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
             xmlns:dxbt="http://schemas.devexpress.com/winfx/2008/xaml/bars/themekeys"
             xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
             xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/core/internal"
             xmlns:dxet="http://schemas.devexpress.com/winfx/2008/xaml/editors/themekeys"
             xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
             xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
             d:DataContext="{d:DesignInstance Type=local:MainTopViewModel}" 
             xmlns:local="clr-namespace:VIZ.Package.Module"
             mc:Ignorable="d" x:Name="uc"
             d:DesignHeight="450" d:DesignWidth="800">

    <UserControl.Resources>
        <fcore:Bool2BoolConverterSimple x:Key="Bool2BoolConverterSimple"></fcore:Bool2BoolConverterSimple>

        <DataTemplate x:Key="ViewItemTemplate">
            <ContentControl>
                <dxb:BarCheckItem Content="{Binding Name}"
                                  IsChecked="{Binding Path=IsClosed,Mode=TwoWay,Converter={StaticResource Bool2BoolConverterSimple}}"></dxb:BarCheckItem>
            </ContentControl>
        </DataTemplate>

    </UserControl.Resources>

    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
    </dxmvvm:Interaction.Behaviors>

    <StackPanel Orientation="Horizontal">
        <Image Source="/VIZ.Package;component/logo.ico" Margin="2,5,2,2"
               VerticalAlignment="Center"></Image>

        <dxb:MainMenuControl Caption="MainMenu" VerticalAlignment="Center" Margin="5,0,0,0">
            <dxb:MainMenuControl.Resources>
                <Style TargetType="dxb:BarSubItem">
                    <Setter Property="Margin" Value="0,0,3,0"></Setter>
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <TextBlock Text="{Binding .}" FontSize="14"></TextBlock>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </dxb:MainMenuControl.Resources>
            <dxb:BarSubItem Content="项目" IsEnabled="{Binding Path=IsVizPreviewReady}">
                <dxb:BarButtonItem Content="新建" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_create_20x20.png"
                                   Command="{Binding Path=CreateProjectCommand}" />
                <dxb:BarButtonItem Content="打开" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_open_20x20.png"  
                                   Command="{Binding Path=OpenProjectCommand}" />
                <dxb:BarButtonItem Content="保存" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_save_20x20.png" 
                                   Command="{Binding Path=SaveProjectCommand}" />
                <dxb:BarButtonItem Content="关闭" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_close_20x20.png" 
                                   Command="{Binding Path=CloseProjectCommand}" />
            </dxb:BarSubItem>
            <dxb:BarSubItem Content="设置" Command="{Binding Path=SettingCommand}">
            </dxb:BarSubItem>
            <dxb:BarSubItem Content="视图" ItemLinksSource="{Binding Path=ItemsSource}" ItemTemplate="{StaticResource ViewItemTemplate}">
            </dxb:BarSubItem>
            <dxb:BarSubItem Content="布局">
                <dxb:BarButtonItem Content="重置布局" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_layout_20x20.png" 
                                   Command="{Binding Path=ResetLayoutCommand}" />
            </dxb:BarSubItem>
            <dxb:BarSubItem Content="帮助">
                <dxb:BarButtonItem Content="关于" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_about_20x20.png" 
                                   Command="{Binding Path=AboutCommand}"/>
            </dxb:BarSubItem>
        </dxb:MainMenuControl>
    </StackPanel>
</UserControl>