AGCTag.xaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <UserControl x:Class="NEIntelligentControl2.Views.AGC.AGCTag"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:NEIntelligentControl2.Views.AGC"
  7. mc:Ignorable="d"
  8. d:DesignHeight="450" d:DesignWidth="800" VerticalAlignment="Center" Background="#01FFFFFF" MouseLeftButtonDown="UserControl_MouseLeftButtonDown">
  9. <UserControl.Resources>
  10. <Style x:Key="TextBlockTitle" TargetType="TextBlock">
  11. <Setter Property="FontWeight" Value="Bold"/>
  12. <Setter Property="FontSize" Value="15"/>
  13. <Setter Property="Foreground" Value="Black"/>
  14. </Style>
  15. </UserControl.Resources>
  16. <Grid>
  17. <Grid Margin="12,7" MaxWidth="265">
  18. <Grid.Style>
  19. <Style TargetType="Grid">
  20. <Style.Triggers>
  21. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="True">
  22. <Setter Property="Visibility" Value="Collapsed"/>
  23. </DataTrigger>
  24. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="False">
  25. <Setter Property="Visibility" Value="Visible"/>
  26. </DataTrigger>
  27. </Style.Triggers>
  28. </Style>
  29. </Grid.Style>
  30. <Grid.ColumnDefinitions>
  31. <ColumnDefinition Width="Auto"/>
  32. <ColumnDefinition/>
  33. <ColumnDefinition Width="Auto"/>
  34. </Grid.ColumnDefinitions>
  35. <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Info.Name}" Style="{StaticResource TextBlockTitle}"/>
  36. <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Value}" Grid.Column="1" Foreground="Black" HorizontalAlignment="Center" FontSize="15"/>
  37. <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Info.Unit}" Grid.Column="2" Style="{StaticResource TextBlockTitle}"/>
  38. </Grid>
  39. <StackPanel Margin="5,7" Orientation="Horizontal">
  40. <StackPanel.Style>
  41. <Style TargetType="StackPanel">
  42. <Style.Triggers>
  43. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="True">
  44. <Setter Property="Visibility" Value="Visible"/>
  45. </DataTrigger>
  46. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=IsDiPoint}" Value="False">
  47. <Setter Property="Visibility" Value="Collapsed"/>
  48. </DataTrigger>
  49. </Style.Triggers>
  50. </Style>
  51. </StackPanel.Style>
  52. <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}, Path=Info.Name}" Style="{StaticResource TextBlockTitle}" VerticalAlignment="Center" FontSize="14"/>
  53. <Image Width="17" Height="17" Margin="2,1" SnapsToDevicePixels="True">
  54. <Image.Style>
  55. <Style TargetType="Image">
  56. <Style.Triggers>
  57. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Value}" Value="0">
  58. <Setter Property="Source" Value="pack://application:,,,/智动启停;component/Images/AGC/agc_off.png"/>
  59. </DataTrigger>
  60. <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Value}" Value="1">
  61. <Setter Property="Source" Value="pack://application:,,,/智动启停;component/Images/AGC/agc_on.png"/>
  62. </DataTrigger>
  63. </Style.Triggers>
  64. </Style>
  65. </Image.Style>
  66. </Image>
  67. </StackPanel>
  68. </Grid>
  69. </UserControl>