WIn_RustTools/RustTools/Views/CodeTablePage.xaml

150 lines
6.8 KiB
Plaintext
Raw Normal View History

2024-08-17 06:41:34 +00:00
<?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"
2024-08-24 11:50:04 +00:00
xmlns:Services="using:RustTools.Services"
2024-08-19 14:30:11 +00:00
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
2024-08-17 06:41:34 +00:00
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
2024-08-19 14:30:11 +00:00
xmlns:datalist="using:RustTools.DataList"
2024-08-17 06:41:34 +00:00
xmlns:local="using:RustTools.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2024-08-19 14:30:11 +00:00
xmlns:themes="using:RustTools.Themes"
2024-08-17 06:41:34 +00:00
mc:Ignorable="d">
2024-08-24 11:50:04 +00:00
<Page.Resources>
<Services:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</Page.Resources>
2024-08-19 14:30:11 +00:00
<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"
2024-08-20 13:34:07 +00:00
KeyDown="searchBox_KeyDown"
PlaceholderText="(Ctrl+J 显示建议列表)"
2024-08-19 14:30:11 +00:00
QueryIcon="Find"
2024-08-20 13:34:07 +00:00
QuerySubmitted="search_QuerySubmitted"
2024-08-19 14:30:11 +00:00
SuggestionChosen="AutoSuggestBox_SuggestionChosen"
2024-08-20 13:34:07 +00:00
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>
2024-08-19 14:30:11 +00:00
</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"
2024-08-24 11:50:04 +00:00
Glyph="&#xF142;"
Visibility="{Binding demo, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=''}" />
2024-08-19 14:30:11 +00:00
</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" />
</TeachingTip.Content>
</TeachingTip>
</Grid>
</Grid>
2024-08-17 06:41:34 +00:00
</Page>