<My:MWindow  xmlns:My="clr-namespace:MyWPFControl.Controls;assembly=MyWPFControl"
                 x:Class="B20UVLog.Windows.DictionarySet"
        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:B20UVLog.Windows" xmlns:viewmodels="clr-namespace:B20UVLog.ViewModels"
             mc:Ignorable="d"
             WindowStyle="ToolWindow"
        Title="字典配置" Height="650" Width="800">
    <Window.DataContext>
        <viewmodels:DictionarySetViewModel/>
    </Window.DataContext>
    <Grid>
        <DockPanel LastChildFill="True" Margin="20">
            <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
                <My:MComboBox Title="选择字典种类" Text="{Binding Type}">
                    <ComboBoxItem>Normal</ComboBoxItem>
                    <ComboBoxItem>Alarm</ComboBoxItem>
                    <ComboBoxItem>Warn</ComboBoxItem>
                </My:MComboBox>
                <My:MTextBox Title="字典编码" Text="{Binding Code}"/>
                <My:MButton Type="Primary" Click="MButton_Search_Click">查询</My:MButton>
                <My:MButton Click="MButton_Reset_Click">条件重置</My:MButton>
                <My:MButton Type="Primary" Click="MButton_Add_Click">新增</My:MButton>
                <My:MButton Type="Success" Click="MButton_Import_Click">导入</My:MButton>
                <My:MButton Type="Warning" Click="MButton_Export_Click">导出</My:MButton>
                <Popup x:Name="PopDict" Placement="Bottom" PopupAnimation="Slide" StaysOpen="False">
                    <Border Background="White" 
                            BorderBrush="{StaticResource DefaultBorderBrushLight}"
                            BorderThickness="{StaticResource DefaultBorderThickness}"
                            Margin="0">
                        <StackPanel Margin="20 5 20 20">
                            <TextBlock x:Name="TextTitle" FontSize="18" Margin="10 10 10 5"/>
                            <My:MComboBox x:Name="EditType" Grid.Row="0" Title="选择字典种类">
                                <ComboBoxItem>Normal</ComboBoxItem>
                                <ComboBoxItem>Alarm</ComboBoxItem>
                                <ComboBoxItem>Warn</ComboBoxItem>
                            </My:MComboBox>
                            <My:MTextBox x:Name="EditCode"  Title="字典编码"/>
                            <My:MTextBox x:Name="EditKey" Title="字典键"/>
                            <My:MTextBox x:Name="EditValue" Title="字典值"/>
                            <My:MButton   Type="Primary" Width="{StaticResource DefaultWidth}" Click="MButton_OK_Click">确定</My:MButton>
                        </StackPanel>
                    </Border>
                </Popup>

            </StackPanel>
            <My:MPagination x:Name="MyPagination" DockPanel.Dock="Bottom" PageIndexChange="MPagination_PageIndexChange" PageSizeChange="MPagination_PageSizeChange"/>
            <My:MDataGrid ItemsSource="{Binding Dicts}" DockPanel.Dock="Top">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="类型" Binding="{Binding Type}" Width="100"></DataGridTextColumn>
                    <DataGridTextColumn Header="编码" Binding="{Binding Code}" Width="100"></DataGridTextColumn>
                    <DataGridTextColumn Header="键" Binding="{Binding Key}" Width="100"></DataGridTextColumn>
                    <DataGridTextColumn Header="值" Binding="{Binding Value}" Width="100"></DataGridTextColumn>
                    <DataGridTemplateColumn>
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <My:MButton IsText="True" Icon="SquareEditOutline" Click="MButton_Edit_Click">编辑</My:MButton>
                                    <My:MButton IsText="True" Icon="TrashCanOutline" Click="MButton_Delete_Click">删除</My:MButton>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </My:MDataGrid>
        </DockPanel>
    </Grid>
</My:MWindow>
