<UserControl x:Class="NEIntelligentControl2.Views.AGC.AGCCard2"
             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:oxy="http://oxyplot.org/wpf"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Margin="25" MinWidth="900">
    <UserControl.Resources>
        <SolidColorBrush x:Key="BorderBrush" Color="#FF253887"/>
        <SolidColorBrush x:Key="BackgroundBrush" Color="#FF253887"/>
    </UserControl.Resources>
    <Grid>
        <Border BorderThickness="2" 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"/>

                <Grid Grid.Row="3" Margin="0,0,0,65">
                    <Grid.Style>
                        <Style TargetType="Grid">
                            <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>
                    </Grid.Style>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="1*"/>
                    </Grid.RowDefinitions>
                    <Canvas Grid.Row="1" x:Name="_c" Margin="30,0,9,0"/>
                </Grid>
                
                <oxy:PlotView x:Name="_pv" Grid.Row="3" Background="Transparent" MouseLeftButtonDown="_pv_MouseLeftButtonDown"/>

            </Grid>
        </Border>
        <Border Width="398" Height="38" Margin="19,0,0,0" BorderThickness="2" Background="#FF3365BF" 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="Black" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" Margin="5,0"/>
                <TextBlock Grid.Column="1" Foreground="Black" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Info.SmallTitle}"/>
                <Image Grid.Column="3" 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>
                <StackPanel Grid.Column="2" VerticalAlignment="Center">
                    <StackPanel.Style>
                        <Style TargetType="StackPanel">
                            <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>
                    </StackPanel.Style>
                    <StackPanel Orientation="Horizontal" Margin="5,0">
                        <TextBlock Text="限电率：" Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center"/>
                        <TextBlock Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=RestrictionValue}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="5,0">
                        <TextBlock Text="偏差率：" Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center"/>
                        <TextBlock x:Name="_cdr" Foreground="{StaticResource BorderBrush}" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=CurveDeviationRate}"/>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
