You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
7.2 KiB

<Border x:Class="SparkClient.Views.Grading.DiamondSelect"
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:SparkClient.Views.Grading"
xmlns:hc="https://handyorg.github.io/handycontrol"
d:DesignWidth="1000"
d:DesignHeight="600"
mc:Ignorable="d">
<Border.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
</Border.Resources>
<Border CornerRadius="15" Padding="15" Background="#F7F7F7">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="350" Width="1*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition MinWidth="300" Width="5*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Type}" Visibility="Hidden" Name="Type"/>
<ScrollViewer Grid.Column="0" Background="#F7F7F7" Opacity="0.9">
<ItemsControl ItemsSource="{Binding Buttons}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Background="Transparent" Command="{Binding Command}" CommandParameter="{Binding Type}" BorderBrush="Transparent" Width="170" Height="170" IsEnabled="{Binding IsEnabled}" FocusVisualStyle="{x:Null}" >
<Border Background="{Binding BackgroundColor}" Width="150" Height="150" CornerRadius="10" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="7*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Image Source="{Binding ImageSource}" Grid.Row="0" Width="102" Height="84" Margin="5 5 5 0"/>
<TextBlock Text="{Binding Text}" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" FontStyle="Normal" Foreground="{Binding ForegroundColor}" Margin="5" />
<TextBlock Visibility="Hidden" Text="{Binding IsHighlighted ,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</Border>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="#ebeef5"></GridSplitter>
<Border Grid.Column="2" Background="#F7F7F7" Opacity="0.9">
<ItemsControl ItemsSource="{Binding Buttons2}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Background="Transparent" Command="{Binding Command}" CommandParameter="{Binding Type}" BorderBrush="Transparent" Width="275" Height="170" FocusVisualStyle="{x:Null}" >
<Button.Style>
<Style TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- 按钮内容 -->
<Border Background="#ebeef5" Width="255" Height="150" CornerRadius="10" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="7*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Border Background="#FFFFFF" CornerRadius="5" BorderThickness="6" BorderBrush="#ebeef5">
<Image Source="{Binding ImageSource}" Height="70"/>
</Border>
<TextBlock Text="{Binding Text}" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Foreground="#4d4d4c"/>
</Grid>
</Border>
<!-- 遮罩层 -->
<Border Name="Overlay" Opacity="0.8" Width="255" Height="150" CornerRadius="10" Visibility="Collapsed">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#36adff" Offset="0"/>
<GradientStop Color="#3c9ce6" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Text="{DynamicResource StartTest}" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" Foreground="#FFFFFF"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Overlay" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
</Grid>
</Border>
</Border>