Files
ShrlAlgoToolkit/MelskinTest/IconsWindow.xaml

135 lines
5.4 KiB
Plaintext
Raw Normal View History

2026-01-02 17:30:41 +08:00
<ms:MelWindow
2026-02-12 21:29:00 +08:00
Height="450"
Title="图标预览"
Width="820"
d:DataContext="{d:DesignInstance Type=local:IconsWindow}"
mc:Ignorable="d"
2026-02-17 22:17:23 +08:00
x:Class="MelskinTest.IconsWindow"
2025-08-20 12:10:35 +08:00
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
2026-02-17 22:17:23 +08:00
xmlns:local="clr-namespace:MelskinTest"
2025-08-20 12:10:35 +08:00
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2026-01-02 17:30:41 +08:00
xmlns:ms="https://github.com/ShrlAlgo/Melskin"
2026-02-12 21:29:00 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
2025-08-20 12:10:35 +08:00
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 第一行: 搜索框 -->
<Border
BorderBrush="LightGray"
2026-02-12 21:29:00 +08:00
BorderThickness="0,0,0,1"
Grid.Row="0"
Padding="10">
2025-08-20 12:10:35 +08:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox
2026-02-12 21:29:00 +08:00
FontSize="14"
2025-08-20 12:10:35 +08:00
Grid.Column="1"
Padding="5"
2026-02-12 21:29:00 +08:00
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
VerticalContentAlignment="Center">
2026-01-02 17:30:41 +08:00
<ms:InputAssist.Suffix>
<ms:IconElement
2025-08-20 12:10:35 +08:00
FontSize="18"
Foreground="Gray"
2026-02-12 21:29:00 +08:00
Margin="0,0,10,0"
Symbol="Search"
VerticalAlignment="Center" />
2026-01-02 17:30:41 +08:00
</ms:InputAssist.Suffix>
2025-08-20 12:10:35 +08:00
</TextBox>
</Grid>
</Border>
<!-- 第二行: 选中图标信息和复制代码 -->
<Border
BorderBrush="LightGray"
2026-02-12 21:29:00 +08:00
BorderThickness="0,0,0,1"
Grid.Row="1"
Padding="10">
2026-01-02 17:30:41 +08:00
<ms:FlexibleRowPanel LayoutMode="Auto">
<TextBlock
2025-08-20 12:10:35 +08:00
FontWeight="Bold"
Foreground="{DynamicResource TextPrimaryBrush}"
2026-02-12 21:29:00 +08:00
Text="选中图标:"
VerticalAlignment="Center" />
2025-08-20 12:10:35 +08:00
<!-- 确保绑定是 OneWay因为我们只从后台更新UI -->
<TextBox
FontWeight="Bold"
Foreground="{DynamicResource PrimaryNormalBrush}"
IsReadOnly="True"
2026-02-12 21:29:00 +08:00
Margin="10,0"
Padding="5"
Text="{Binding SelectedSymbolName, Mode=OneWay, FallbackValue='请选择一个图标...'}"
VerticalAlignment="Center"
2026-02-12 21:29:00 +08:00
ms:FlexibleRowPanel.IsFill="True" />
<Button
Click="CopyCode_Click"
2026-02-12 21:29:00 +08:00
Content="复制代码"
Padding="10,5"
VerticalAlignment="Center" />
2026-01-02 17:30:41 +08:00
<ms:ColorPicker
2025-08-20 12:10:35 +08:00
Margin="10,0,0,0"
2026-02-12 21:29:00 +08:00
VerticalAlignment="Center"
x:Name="ColorPicker" />
2026-01-02 17:30:41 +08:00
</ms:FlexibleRowPanel>
2025-08-20 12:10:35 +08:00
</Border>
<!-- 第三行: 图标浏览器 -->
<ListBox
Grid.Row="2"
ItemsSource="{Binding SymbolCollectionView}"
2026-02-12 21:29:00 +08:00
Name="IconItemsControl"
2025-08-20 12:10:35 +08:00
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionChanged="IconItemsControl_SelectionChanged"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
2025-08-20 12:10:35 +08:00
<ListBox.Foreground>
<SolidColorBrush Color="{Binding ElementName=ColorPicker, Path=SelectedColor}" />
</ListBox.Foreground>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel ItemHeight="80" ItemWidth="80" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center">
2026-01-02 17:30:41 +08:00
<ms:IconElement
2025-08-20 12:10:35 +08:00
FontSize="32"
Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=Foreground}"
Symbol="{Binding}"
ToolTip="{Binding}" />
<TextBlock
FontSize="12"
2026-02-12 21:29:00 +08:00
HorizontalAlignment="Center"
Margin="0,5,0,0"
2025-08-20 12:10:35 +08:00
Text="{Binding}"
TextWrapping="Wrap"
2026-02-12 21:29:00 +08:00
ToolTip="{Binding}"
VerticalAlignment="Center" />
2025-08-20 12:10:35 +08:00
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<!--<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#CCE8FF" />
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>-->
</ListBox>
</Grid>
2026-01-02 17:30:41 +08:00
</ms:MelWindow>