<UserControl
    x:Class="HBLConsole.View.ProcessMonitoringView"
    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:local="clr-namespace:HBLConsole.View"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pry="clr-namespace:HBLConsole.PryUserControl;assembly=HBLConsole.PryUserControl"
    xmlns:vm="clr-namespace:HBLConsole.ViewModel"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">

    <UserControl.DataContext>
        <vm:ProcessMonitoringViewModel />
    </UserControl.DataContext>

    <UserControl.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml">

                    <!--#region 开关按钮样式-->
                    <Style x:Key="ToggleButStyle" TargetType="{x:Type ToggleButton}">
                        <Setter Property="IsChecked" Value="False" />
                        <Setter Property="FontFamily" Value="楷体" />
                        <Setter Property="Foreground" Value="#ddd" />
                        <Setter Property="IsEnabled" Value="False" />
                        <Setter Property="FontSize" Value="18" />
                        <Setter Property="Margin" Value="0,0,10,0" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <!--<Grid x:Name="gr" SnapsToDevicePixels="True">-->
                                    <Border
                                        Name="br"
                                        Background="#FF1E9614"
                                        CornerRadius="5">
                                        <ContentPresenter
                                            x:Name="contentPresenter"
                                            Margin="4,2"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center"
                                            Content="{TemplateBinding Content}"
                                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                            Focusable="False"
                                            RecognizesAccessKey="True"
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                    </Border>

                                    <!--</Grid>-->
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter TargetName="br" Property="Background" Value="#FF1E9614" />
                                        </Trigger>

                                        <Trigger Property="IsChecked" Value="False">
                                            <Setter TargetName="br" Property="Background" Value="#FFF11A38" />
                                        </Trigger>

                                        <Trigger Property="IsMouseOver" Value="True">
                                            <!--<Setter TargetName="tb" Property="Foreground" Value="#2695FF" />-->
                                        </Trigger>

                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>

                    <!--#endregion-->

                    <!--#region ListBox样式-->
                    <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
                        <Setter Property="OverridesDefaultStyle" Value="True" />
                        <Setter Property="SnapsToDevicePixels" Value="True" />
                        <Setter Property="BorderBrush" Value="{x:Null}" />
                        <Setter Property="Foreground" Value="White" />
                        <Setter Property="FontSize" Value="20" />
                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                        <Setter Property="VerticalContentAlignment" Value="Center" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <Border x:Name="border" CornerRadius="8">
                                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                    <!--<ControlTemplate.Triggers>
                                        <Trigger Property="IsSelected" Value="True">
                                            <Setter TargetName="border" Property="Background">
                                                <Setter.Value>
                                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                        <GradientStop Offset="0.5" Color="#FF6B6B6B" />
                                                        <GradientStop Offset="0.5" Color="#FF535353" />
                                                        <GradientStop Offset="0.022" Color="#FF535353" />
                                                        <GradientStop Offset="0.991" Color="#FF555555" />
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                        </Trigger>
                                    </ControlTemplate.Triggers>-->
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <!--#endregion-->
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <ScrollViewer
            HorizontalScrollBarVisibility="Visible"
            Style="{StaticResource ScrollViewerStyle}"
            VerticalScrollBarVisibility="Visible">
            <ItemsControl ItemsSource="{Binding processConditions}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0,10" VerticalAlignment="Center">

                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="200" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>

                                <pry:BeveledButton
                                    x:Name="bb"
                                    IsParallelogram="False"
                                    StrokeThickness="1">
                                    <pry:BeveledButton.FillColor>
                                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                            <GradientStop Color="#ff1247EC" />
                                            <GradientStop Offset="1" Color="#111247EC" />
                                        </LinearGradientBrush>
                                    </pry:BeveledButton.FillColor>
                                </pry:BeveledButton>

                                <TextBlock
                                    Margin="2"
                                    VerticalAlignment="Center"
                                    FontFamily="楷体"
                                    FontSize="16"
                                    Foreground="Aqua"
                                    Text="{Binding ProcessTitl}" />
                            </Grid>

                            <ListBox
                                x:Name="lstEnt"
                                Margin="0,3,0,0"
                                Background="{x:Null}"
                                BorderBrush="{x:Null}"
                                BorderThickness="0"
                                ItemContainerStyle="{StaticResource ResourceKey=ListBoxItemStyle1}"
                                ItemsSource="{Binding Conditions}">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <ToggleButton
                                            Content="{Binding propertyIllustrate}"
                                            IsChecked="{Binding ConditionMet}"
                                            Style="{StaticResource ToggleButStyle}"
                                            ToolTip="{Binding ToolTip}" />
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</UserControl>
