<UserControl x:Class="NEIntelligentControl2.Views.AGC.AGCCard"
             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:local="clr-namespace:NEIntelligentControl2.Views.AGC"
             xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
             mc:Ignorable="d" 
             d:DesignHeight="470" d:DesignWidth="590" Margin="10,50" MinWidth="455">
    <UserControl.Resources>
        <SolidColorBrush x:Key="BorderBrush" Color="#FF31B9FB"/>
        <SolidColorBrush x:Key="BackgroundBrush" Color="#FF021831"/>
    </UserControl.Resources>
    <Grid>
        <Border BorderThickness="1" BorderBrush="{StaticResource BorderBrush}" Margin="0,19,0,0" SnapsToDevicePixels="True">
            <Grid Margin="0,19,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <UniformGrid x:Name="_UGMain" Columns="2"/>

                <UniformGrid x:Name="_UGDiPoint" Grid.Row="1" Columns="4"/>

                <Rectangle Grid.Row="2" Margin="3" Fill="{StaticResource BorderBrush}" Height="1" SnapsToDevicePixels="True"/>

                <!--<WindowsFormsHost Grid.Row="3">
                    <local:WindLineChart x:Name="_WLCMain" Dock="Fill"/>
                </WindowsFormsHost>-->

                <lvc:CartesianChart x:Name="_Chart"  Grid.Row="3" LegendLocation="Bottom" Foreground="#FFD4D4D4" DisableAnimations="True">
                    <lvc:CartesianChart.AxisX>
                        <lvc:Axis x:Name="_ChartAxisX">
                            <lvc:Axis.Separator>
                                <lvc:Separator Stroke="{x:Null}"/>
                            </lvc:Axis.Separator>
                        </lvc:Axis>
                    </lvc:CartesianChart.AxisX>
                    <lvc:CartesianChart.AxisY>
                        <lvc:Axis>
                            <lvc:Axis.Separator>
                                <lvc:Separator Stroke="{x:Null}"/>
                            </lvc:Axis.Separator>
                        </lvc:Axis>
                    </lvc:CartesianChart.AxisY>

                    <lvc:CartesianChart.DataTooltip>
                        <lvc:DefaultTooltip Background="#CC2B4056" CornerRadius="7"/>
                    </lvc:CartesianChart.DataTooltip>

                    <lvc:CartesianChart.Series>
                        <lvc:LineSeries Title="实发有功" x:Name="_LSPower" PointForeground="Transparent" Stroke="SandyBrown" Fill="Transparent" PointGeometry="{x:Null}" StrokeThickness="1.2"/>
                        <lvc:LineSeries Title="有功设定" x:Name="_LSPowerSet" PointForeground="Transparent" Stroke="#FF31B9FB" Fill="Transparent" PointGeometry="{x:Null}" StrokeThickness="1.2"/>
                    </lvc:CartesianChart.Series>
                </lvc:CartesianChart>
            </Grid>
        </Border>
        <Border Width="368" Height="38" Margin="19,0,0,0" BorderThickness="1" Background="{StaticResource BackgroundBrush}" BorderBrush="{StaticResource BorderBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" SnapsToDevicePixels="True">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Info.Title}" Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" Margin="5,0"/>
                <TextBlock Grid.Column="1" Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Info.SmallTitle}"/>
                <Image Grid.Column="2" VerticalAlignment="Center" Width="24" Height="24" Margin="5,0">
                    <Image.Style>
                        <Style TargetType="Image">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Status}" Value="0">
                                    <Setter Property="Source" Value="pack://application:,,,/智动启停;component/Images/AGC/unrestricted.png"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Status}" Value="1">
                                    <Setter Property="Source" Value="pack://application:,,,/智动启停;component/Images/AGC/restricted.png"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Image.Style>
                </Image>
                <TextBlock Grid.Column="3" Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=RestrictionValue}" Margin="5,0">
                    <TextBlock.Style>
                        <Style TargetType="TextBlock">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Status}" Value="0">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Status}" Value="1">
                                    <Setter Property="Visibility" Value="Visible"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </TextBlock.Style>
                </TextBlock>
            </Grid>
        </Border>
    </Grid>
</UserControl>
