<UserControl x:Class="NEIntelligentControl2.Views.AGC.AGCTag"
             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"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" VerticalAlignment="Center" Background="#01FFFFFF" MouseLeftButtonDown="UserControl_MouseLeftButtonDown">
    <UserControl.Resources>
        <Style x:Key="TextBlockTitle" TargetType="TextBlock">
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="FontSize" Value="15"/>
            <Setter Property="Foreground" Value="Black"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid Margin="12,7" MaxWidth="265">
            <Grid.Style>
                <Style TargetType="Grid">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="True">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="False">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Info.Name}" Style="{StaticResource TextBlockTitle}"/>
            <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Value}" Grid.Column="1" Foreground="Black" HorizontalAlignment="Center" FontSize="15"/>
            <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Info.Unit}" Grid.Column="2" Style="{StaticResource TextBlockTitle}"/>
        </Grid>
        <StackPanel Margin="5,7" Orientation="Horizontal">
            <StackPanel.Style>
                <Style TargetType="StackPanel">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="True">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="False">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Style>
            <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Info.Name}" Style="{StaticResource TextBlockTitle}" VerticalAlignment="Center" FontSize="14"/>
            <Image Width="17" Height="17" Margin="2,1" SnapsToDevicePixels="True">
                <Image.Style>
                    <Style TargetType="Image">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Value}" Value="0">
                                <Setter Property="Source" Value="pack://application:,,,/智动启停;component/Images/AGC/agc_off.png"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Value}" Value="1">
                                <Setter Property="Source" Value="pack://application:,,,/智动启停;component/Images/AGC/agc_on.png"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
        </StackPanel>
    </Grid>
</UserControl>
