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.
335 lines
18 KiB
335 lines
18 KiB
<UserControl x:Class="AIK.Views.MenuPages.RemoteGeneration.RemoteGenerationPage"
|
|
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:AIK.Views.MenuPages.RemoteGeneration"
|
|
mc:Ignorable="d"
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
xmlns:behaviors="clr-namespace:AIK.Behaviors;assembly=AIK.Behaviors"
|
|
xmlns:convert="clr-namespace:AIK.Views.Converters"
|
|
xmlns:commonPage="clr-namespace:AIK.Views.MenuPages.CommonPage"
|
|
d:DesignHeight="800" d:DesignWidth="1400">
|
|
<i:Interaction.Behaviors>
|
|
<behaviors:ViewModelInitializationBehavior/>
|
|
</i:Interaction.Behaviors>
|
|
<UserControl.Resources>
|
|
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="pack://application:,,,/AIK.Assets;component/Styles/ScrollViewerStyle.xaml"/>
|
|
|
|
</ResourceDictionary.MergedDictionaries>
|
|
<convert:SelectedToBackgroundConverter x:Key="SelectedToBackgroundConverter"/>
|
|
<convert:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
|
<ControlTemplate x:Key="FilletTextBox" TargetType="{x:Type TextBox}">
|
|
<Border>
|
|
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
<!-- 添加加载动画样式 -->
|
|
<Style x:Key="LoadingIndicatorStyle" TargetType="Control">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Control">
|
|
<Border Background="#80FFFFFF"
|
|
CornerRadius="8"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Center"
|
|
Padding="20">
|
|
<StackPanel Orientation="Vertical"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center">
|
|
<ProgressBar IsIndeterminate="True"
|
|
Width="60"
|
|
Height="6"
|
|
Background="#E0E0E0"
|
|
Foreground="#0078D7"
|
|
Margin="0,0,0,10"/>
|
|
<TextBlock Text="加载中..."
|
|
HorizontalAlignment="Center"
|
|
Foreground="#666666"
|
|
FontSize="14"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
<Style x:Key="CustomFilletTextBoxStyle" TargetType="{x:Type TextBox}">
|
|
<Setter Property="Template" Value="{StaticResource FilletTextBox}"/>
|
|
<Setter Property="BorderBrush" Value="#FFE9ECEF"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
<Setter Property="Background" Value="White"/>
|
|
<Setter Property="Padding" Value="10,5"/>
|
|
<Setter Property="Tag" Value="10"/>
|
|
<!-- 使用 Tag 存储圆角值 -->
|
|
</Style>
|
|
<!-- 本地样式定义 -->
|
|
<Style x:Key="LetterHeaderStyle" TargetType="TextBlock">
|
|
<Setter Property="FontSize" Value="18"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Foreground" Value="#FF333333"/>
|
|
<Setter Property="Margin" Value="10,15,0,5"/>
|
|
<Setter Property="Padding" Value="5,0,0,0"/>
|
|
<Setter Property="Background" Value="#FFF8F8F8"/>
|
|
</Style>
|
|
|
|
<Style x:Key="WordItemStyle" TargetType="Button">
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
|
<Setter Property="Padding" Value="25,8,0,8"/>
|
|
<Setter Property="Margin" Value="0,0,0,0"/>
|
|
<Setter Property="FontSize" Value="16"/>
|
|
<Setter Property="Foreground" Value="#FF444444"/>
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border Background="Transparent"
|
|
CornerRadius="4"
|
|
Padding="{TemplateBinding Padding}">
|
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Foreground" Value="#FF0078D7"/>
|
|
<Setter Property="Background" Value="#FFF5F5F5"/>
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter Property="Background" Value="#FFE0E0E0"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style x:Key="NoResultsStyle" TargetType="TextBlock">
|
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
<Setter Property="FontSize" Value="16"/>
|
|
<Setter Property="Foreground" Value="#FF888888"/>
|
|
<Setter Property="Margin" Value="0,40,0,0"/>
|
|
</Style>
|
|
|
|
<Style x:Key="LetterIndexButtonStyle" TargetType="Button">
|
|
<Setter Property="Width" Value="28"/>
|
|
<Setter Property="Margin" Value="0,0.5"/>
|
|
<Setter Property="Padding" Value="0"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Foreground" Value="#FF666666"/>
|
|
<Setter Property="FontSize" Value="11"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border x:Name="border"
|
|
Background="{TemplateBinding Background}"
|
|
CornerRadius="12">
|
|
<ContentPresenter HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="border" Property="Background" Value="#FFEAF4FF"/>
|
|
<Setter Property="Foreground" Value="#FF0078D7"/>
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter TargetName="border" Property="Background" Value="#FFD8ECFF"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<!-- 搜索框样式 -->
|
|
<Style x:Key="ModernSearchTextBoxStyle" TargetType="TextBox">
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="BorderBrush" Value="#FFE9ECEF"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="FontSize" Value="14"/>
|
|
<Setter Property="Foreground" Value="#2D3748"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
<Setter Property="Height" Value="36"/>
|
|
<!--<Setter Property="CaretBrush" Value="#0078D7"/>-->
|
|
<!--<Setter Property="SelectionOpacity" Value="0.3"/>-->
|
|
<Style.Triggers>
|
|
<Trigger Property="IsFocused" Value="True">
|
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="BorderThickness" Value="1.5"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
</ResourceDictionary>
|
|
|
|
</UserControl.Resources>
|
|
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="240"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 搜索区域 -->
|
|
<Border Grid.Row="0"
|
|
Grid.Column="0"
|
|
Background="White"
|
|
CornerRadius="10"
|
|
BorderBrush="#FFE0E0E0"
|
|
BorderThickness="1"
|
|
Margin="20,20,20,10">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 搜索输入框 -->
|
|
<TextBox x:Name="SearchTextBox"
|
|
behaviors:PlaceholderBehavior.PlaceholderText="{DynamicResource SearchCarBrand}"
|
|
Grid.Column="0"
|
|
Style="{StaticResource CustomFilletTextBoxStyle}"
|
|
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
|
|
Margin="0,0,0,0"
|
|
>
|
|
<TextBox.InputBindings>
|
|
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
|
|
</TextBox.InputBindings>
|
|
</TextBox>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- 内容区域 -->
|
|
<Border Grid.Row="1"
|
|
Grid.Column="0"
|
|
Background="White"
|
|
CornerRadius="8"
|
|
BorderBrush="#FFE0E0E0"
|
|
BorderThickness="1"
|
|
Margin="20,0,20,20">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="42"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<ItemsControl Grid.Column="0"
|
|
ItemsSource="{Binding LetterIndexes, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
Margin="6,8,2,8"
|
|
VerticalAlignment="Stretch">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<UniformGrid Rows="26"/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Button Content="{Binding}"
|
|
Style="{StaticResource LetterIndexButtonStyle}"
|
|
Click="LetterIndexButton_Click"/>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<ScrollViewer Grid.Column="1"
|
|
Template="{StaticResource MyScrollViewer}"
|
|
VerticalAlignment="Top"
|
|
x:Name="scrList"
|
|
Margin="0"
|
|
VerticalScrollBarVisibility="Auto">
|
|
<ItemsControl x:Name="BrandGroupsList"
|
|
ItemsSource="{Binding FilteredGroups}">
|
|
<ItemsControl.Style>
|
|
<Style TargetType="ItemsControl">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ItemsControl">
|
|
<ItemsPresenter/>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding FilteredGroups.Count}" Value="0">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate>
|
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
<TextBlock Text="{DynamicResource TryOtherBrands}"
|
|
Style="{StaticResource NoResultsStyle}" TextWrapping="Wrap"/>
|
|
<TextBlock Text="{DynamicResource TryOtherKeywords}"
|
|
TextWrapping="Wrap"
|
|
Style="{StaticResource NoResultsStyle}"
|
|
FontSize="14"
|
|
Margin="0,10,0,0"/>
|
|
</StackPanel>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ItemsControl.Style>
|
|
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Margin="0,5"
|
|
Tag="{Binding Letter}">
|
|
<!-- 字母标题 -->
|
|
<TextBlock Text="{Binding Letter}"
|
|
Style="{StaticResource LetterHeaderStyle}"/>
|
|
<!-- 单词列表 -->
|
|
<ItemsControl ItemsSource="{Binding Items}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border Background="{Binding IsSelected, Converter={StaticResource SelectedToBackgroundConverter}}"
|
|
BorderThickness="1"
|
|
CornerRadius="4"
|
|
Margin="5,2">
|
|
<Button Content="{Binding brandName}"
|
|
Style="{StaticResource WordItemStyle}"
|
|
Command="{Binding DataContext.RequestUpdateBCommand,
|
|
RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
CommandParameter="{Binding}"/>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
</Border>
|
|
<!-- 添加加载遮罩层 -->
|
|
<Border x:Name="LoadingOverlay"
|
|
Grid.Row="1" Grid.RowSpan="2"
|
|
Grid.Column="0" Grid.ColumnSpan="2"
|
|
Background="#40FFFFFF"
|
|
Visibility="{Binding IsLoading, Converter={StaticResource BoolToVisibilityConverter}}"
|
|
Panel.ZIndex="999">
|
|
<Control Style="{StaticResource LoadingIndicatorStyle}"/>
|
|
</Border>
|
|
<Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Margin="-20,20,0,0">
|
|
<commonPage:KeyModelPage DataContext="{Binding KeyModelVM}"/>
|
|
</Grid>
|
|
|
|
</Grid>
|
|
</UserControl>
|
|
|