<hc:Window
    x:Class="HKCardOUT.Views.RootView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:hc="https://handyorg.github.io/handycontrol"
    xmlns:helper="clr-namespace:HKCardOUT.Helper"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:s="https://github.com/canton7/Stylet"
    xmlns:viewModels="clr-namespace:HKCardOUT.ViewModels"
    x:Name="Main"
    Title="海科智慧一卡通平台"
    d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}"
    ShowMaxButton="False"
    ShowMinButton="False"
    ShowTitle="True"
    Visibility="Hidden"
    WindowStartupLocation="CenterScreen"
    WindowState="Maximized"
    mc:Ignorable="d">
    <hc:Window.Resources>
        <helper:HKConverter x:Key="TOC" />
        <Style x:Key="SaleLogHeader" TargetType="DataGridColumnHeader">
            <Setter Property="FontSize" Value="18" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        <Style x:Key="CenterAlignmentStyle" TargetType="TextBlock">
            <Setter Property="TextAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FontSize" Value="22" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Background" Value="Transparent" />
        </Style>
    </hc:Window.Resources>
    <hc:Window.Background>
        <ImageBrush ImageSource="/HKResouces/背景.jpg" />
    </hc:Window.Background>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="200" />
        </Grid.ColumnDefinitions>
        <DataGrid
            AutoGenerateColumns="False"
            Background="Transparent"
            IsReadOnly="True"
            ItemsSource="{Binding Result}"
            Style="{StaticResource DataGridBaseStyle}">
            <DataGrid.RowStyle>
                <Style BasedOn="{StaticResource DataGridRowStyle}" TargetType="DataGridRow">
                    <Setter Property="Background" Value="Transparent" />
                    <Style.Triggers>
                        <Trigger Property="UIElement.IsMouseOver" Value="true">
                            <Setter Property="Background" Value="Transparent" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <DataGridTextColumn
                    Width="300"
                    Binding="{Binding CardNo}"
                    ElementStyle="{StaticResource CenterAlignmentStyle}"
                    Header="卡号"
                    HeaderStyle="{StaticResource SaleLogHeader}" />
                <!--<DataGridTextColumn
                    Width="200"
                    Binding="{Binding Money}"
                    ElementStyle="{StaticResource CenterAlignmentStyle}"
                    Header="金额"
                    HeaderStyle="{StaticResource SaleLogHeader}" />-->
                <DataGridTextColumn
                    Width="200"
                    Binding="{Binding Location}"
                    ElementStyle="{StaticResource CenterAlignmentStyle}"
                    Header="档口"
                    HeaderStyle="{StaticResource SaleLogHeader}" />
                <DataGridTextColumn
                    Width="200"
                    Binding="{Binding Count}"
                    ElementStyle="{StaticResource CenterAlignmentStyle}"
                    Header="刷卡次数"
                    HeaderStyle="{StaticResource SaleLogHeader}" />
                <!--<DataGridTextColumn
                    Width="300"
                    Binding="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}, UpdateSourceTrigger=PropertyChanged}"
                    ElementStyle="{StaticResource CenterAlignmentStyle}"
                    Header="消费时间"
                    HeaderStyle="{StaticResource SaleLogHeader}" />-->
            </DataGrid.Columns>
        </DataGrid>
        <ListBox
            Grid.Column="1"
            Background="Transparent"
            BorderThickness="0"
            ItemsSource="{Binding Ad}"
            Style="{StaticResource WrapPanelVerticalListBox}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button
                        Width="160"
                        Height="80"
                        Margin="20,20,0,0"
                        Style="{StaticResource ButtonDefault}">
                        <Button.Content>
                            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                                <TextBlock
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    FontSize="18"
                                    FontWeight="Bold"
                                    Text="{Binding Stalls, StringFormat=档口:{0}}" />
                                <TextBlock
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    FontSize="18"
                                    FontWeight="Bold"
                                    Text="{Binding Device, StringFormat=设备:{0}}" />
                                <!--<TextBlock
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    FontSize="18"
                                    FontWeight="Bold"
                                    Foreground="Red"
                                    Text="{Binding IsActive, Converter={StaticResource TOC}, StringFormat=广告:{0}}" />-->
                            </StackPanel>
                        </Button.Content>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

</hc:Window>
