WIn_RustTools/RustTools/Views/CodeTablePage.xaml

151 lines
6.9 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="RustTools.Views.CodeTablePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Services="using:RustTools.Services"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:datalist="using:RustTools.DataList"
xmlns:local="using:RustTools.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:themes="using:RustTools.Themes"
mc:Ignorable="d">
<Page.Resources>
<Services:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,9">
<AutoSuggestBox
x:Name="search"
KeyDown="searchBox_KeyDown"
PlaceholderText="(Ctrl+J 显示建议列表)"
QueryIcon="Find"
QuerySubmitted="search_QuerySubmitted"
SuggestionChosen="AutoSuggestBox_SuggestionChosen"
TextChanged="search_TextChanged"
TextMemberPath="key">
<AutoSuggestBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="{Binding key}" />
<TextBlock
Margin="9,0,0,0"
VerticalAlignment="Center"
Text="{Binding value}" />
</StackPanel>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
</StackPanel>
<Grid Grid.Row="1" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ListView
x:Name="keyListView"
Grid.Column="0"
MinWidth="100"
MaxWidth="260"
Padding="0,0,9,0"
ItemsSource="{x:Bind codeList}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionChanged="keyListView_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Padding="6">
<TextBlock
FontFamily="Body"
Style="{StaticResource BodyTextStyle}"
Text="{Binding CnKey}" />
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding Key}" />
<TextBlock
Margin="0,3,0,0"
FontFamily="Times New Roman"
FontSize="12">
<Run FontFamily="Thin" Text="共" />
<Run FontFamily="Thin" Text="{Binding Vaule.Count}" />
<Run FontFamily="Thin" Text="个代码" />
</TextBlock>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<controls:ContentSizer Grid.Column="1" TargetControl="{x:Bind keyListView}" />
<ListView
x:Name="valueListView"
Grid.Column="2"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="datalist:CodeTable_Data">
<Grid
Margin="0,0,0,9"
Padding="13"
Background="{StaticResource CardBackgroundFillColorDefault}"
CornerRadius="9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock
Foreground="{StaticResource AccentTextFillColorTertiaryBrush}"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{Binding translate}" />
<TextBlock
Margin="0,9,0,0"
Foreground="{StaticResource TextFillColorTertiaryBrush}"
IsTextSelectionEnabled="True"
Text="{Binding code}" />
<TextBlock
Margin="0,9,0,0"
IsTextSelectionEnabled="True"
Style="{StaticResource BodyTextBlockStyle}"
Text="{Binding description}" />
<TextBlock
Margin="0,9,0,0"
Foreground="{StaticResource TextFillColorTertiaryBrush}"
IsTextSelectionEnabled="True"
Style="{StaticResource BodyTextBlockStyle}"
Text="{Binding type}" />
</StackPanel>
<themes:ButtonIcon
Grid.Column="1"
VerticalAlignment="Top"
Click="List_ButtonIcon_Click"
Glyph="&#xF142;"
Visibility="{Binding demo, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=''}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<TeachingTip
x:Name="ToggleThemeTeachingTip1"
Title="示例"
IsLightDismissEnabled="True">
<TeachingTip.Content>
<TextBlock
x:Name="ToastTextBlock"
Margin="0,16,0,0"
IsTextSelectionEnabled="True"
TextWrapping="Wrap" />
</TeachingTip.Content>
</TeachingTip>
</Grid>
</Grid>
</Page>