Files
ShrlAlgoToolkit/NeoUI/NeoUITest/IconsWindow.xaml
2025-10-04 08:52:23 +08:00

135 lines
5.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<n:NeoWindow
x:Class="NeoUITest.IconsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:NeoUITest"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:n="https://github.com/ShrlAlgo/NeoUI"
Title="图标预览"
Width="820"
Height="450"
d:DataContext="{d:DesignInstance Type=local:IconsWindow}"
mc:Ignorable="d">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 第一行: 搜索框 -->
<Border
Grid.Row="0"
Padding="10"
BorderBrush="LightGray"
BorderThickness="0,0,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBox
Grid.Column="1"
Padding="5"
VerticalContentAlignment="Center"
FontSize="14"
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}">
<n:InputAssist.Suffix>
<n:IconElement
Margin="0,0,10,0"
VerticalAlignment="Center"
FontSize="18"
Foreground="Gray"
Symbol="Search" />
</n:InputAssist.Suffix>
</TextBox>
</Grid>
</Border>
<!-- 第二行: 选中图标信息和复制代码 -->
<Border
Grid.Row="1"
Padding="10"
BorderBrush="LightGray"
BorderThickness="0,0,0,1">
<n:FlexibleRowPanel LayoutMode="Auto">
<TextBlock
VerticalAlignment="Center"
FontWeight="Bold"
Foreground="{DynamicResource TextPrimaryBrush}"
Text="选中图标:" />
<!-- 确保绑定是 OneWay因为我们只从后台更新UI -->
<TextBox
Margin="10,0"
Padding="5"
VerticalAlignment="Center"
n:FlexibleRowPanel.IsFill="True"
FontWeight="Bold"
Foreground="{DynamicResource PrimaryNormalBrush}"
IsReadOnly="True"
Text="{Binding SelectedSymbolName, Mode=OneWay, FallbackValue='请选择一个图标...'}" />
<Button
Padding="10,5"
VerticalAlignment="Center"
Click="CopyCode_Click"
Content="复制代码" />
<n:ColorPicker
x:Name="ColorPicker"
Margin="10,0,0,0"
VerticalAlignment="Center" />
</n:FlexibleRowPanel>
</Border>
<!-- 第三行: 图标浏览器 -->
<ListBox
Name="IconItemsControl"
Grid.Row="2"
ItemsSource="{Binding SymbolCollectionView}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionChanged="IconItemsControl_SelectionChanged"
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<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">
<n:IconElement
FontSize="32"
Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=Foreground}"
Symbol="{Binding}"
ToolTip="{Binding}" />
<TextBlock
Margin="0,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Text="{Binding}"
TextWrapping="Wrap"
ToolTip="{Binding}" />
</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>
</n:NeoWindow>