| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <UserControl x:Class="SWRIS.Controls.DamageRecordControl"
- 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:SWRIS.Controls" xmlns:cvt="clr-namespace:SWRIS.Converters"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800">
- <UserControl.Resources>
- <cvt:RiskLevelToColorConverter x:Key="RiskLevelToColorConverter"/>
- <cvt:RiskLevelToTextConverter x:Key="RiskLevelToTextConverter"/>
- <Storyboard x:Key="NewItemGlowAnimation" RepeatBehavior="3x">
- <DoubleAnimation
- Storyboard.TargetProperty="Effect.Opacity"
- From="0" To="0.7" Duration="0:0:0.20"
- AutoReverse="True"/>
- </Storyboard>
- </UserControl.Resources>
- <Border CornerRadius="10" Background="#1e1d43">
- <StackPanel Orientation="Vertical">
- <Border CornerRadius="10">
- <Border.Background>
- <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
- <GradientStop Color="#1f1e44" Offset="0"/>
- <GradientStop Color="#36366d" Offset="1"/>
- </LinearGradientBrush>
- </Border.Background>
- <TextBlock Text="{Binding Title, RelativeSource={RelativeSource AncestorType=UserControl}}"
- HorizontalAlignment="Center" FontSize="22" FontFamily="{StaticResource PuHuiTiBold}" FontWeight="Bold" Margin="14" />
- </Border>
- <ScrollViewer MaxHeight="842" VerticalScrollBarVisibility="Hidden" Margin="25,8">
- <StackPanel Orientation="Vertical">
- <ItemsControl ItemsSource="{Binding Records, RelativeSource={RelativeSource AncestorType=UserControl}}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Border Background="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}, ConverterParameter=0.15}"
- CornerRadius="10" Height="110" Width="295" Margin="0,7">
- <Border.Effect>
- <DropShadowEffect x:Name="GlowEffect"
- ShadowDepth="0"
- BlurRadius="1"
- Color="#00ffff"
- Opacity="0"/>
- </Border.Effect>
- <!-- 新项发光触发器 -->
- <Border.Style>
- <Style TargetType="Border">
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsNew}" Value="True">
- <DataTrigger.EnterActions>
- <BeginStoryboard Storyboard="{StaticResource NewItemGlowAnimation}"/>
- </DataTrigger.EnterActions>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <!-- 鼠标悬停触发器 -->
- <Border.Triggers>
- <EventTrigger RoutedEvent="MouseEnter">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetProperty="Effect.Opacity"
- From="0" To="0.7" Duration="0:0:0.20"
- AutoReverse="True" RepeatBehavior="1x"/>
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- <EventTrigger RoutedEvent="MouseLeave">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetProperty="Effect.Opacity"
- To="0" Duration="0:0:0.1"/>
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- </Border.Triggers>
- <StackPanel Orientation="Horizontal">
- <!-- 风险等级指示器 -->
- <Border CornerRadius="10" Width="35" Height="110"
- Background="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}, ConverterParameter=0.8}">
- <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
- <TextBlock FontSize="18" FontWeight="Bold" FontFamily="{StaticResource PuHuiTiBold}"
- Text="{Binding RiskLevel, Converter={StaticResource RiskLevelToTextConverter}, ConverterParameter=0}"/>
- <TextBlock FontSize="18" FontWeight="Bold" FontFamily="{StaticResource PuHuiTiBold}"
- Text="{Binding RiskLevel, Converter={StaticResource RiskLevelToTextConverter}, ConverterParameter=1}"/>
- </StackPanel>
- </Border>
- <!-- 内容区域 -->
- <StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="18,0" Tag="{Binding Id}"
- MouseLeftButtonDown="Record_MouseDown" Cursor="Hand">
- <TextBlock Text="{Binding RopeName}" FontSize="18" FontWeight="Bold" FontFamily="{StaticResource PuHuiTiBold}"
- Margin="0,5,0,8"
- Foreground="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}}"/>
- <TextBlock Text="{Binding Time, StringFormat='yyyy/MM/dd HH:mm:ss'}" FontSize="18"
- Foreground="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}}"/>
- <TextBlock Text="{Binding Description}" FontSize="18" Margin="0,0,0,3"
- Foreground="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}}"/>
- </StackPanel>
- </StackPanel>
- </Border>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </StackPanel>
- </ScrollViewer>
- </StackPanel>
- </Border>
- </UserControl>
|