mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-24 18:44:38 +08:00
fead.做桌面组件ing,智教hub加了rinshub
This commit is contained in:
@@ -1,30 +1,113 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LanMountainDesktop.Views.FusedDesktopComponentLibraryControl"
|
||||
Width="400" Height="500">
|
||||
<!--
|
||||
融合桌面组件库 - 专门用于添加组件到系统桌面(负一屏)
|
||||
注意:此窗口只能添加组件到融合桌面,不能添加到阑山桌面
|
||||
-->
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<!-- 标题栏 -->
|
||||
<Border Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}"
|
||||
Padding="16,12">
|
||||
<StackPanel>
|
||||
<TextBlock Text="融合桌面组件"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="16" />
|
||||
<TextBlock Text="选择组件添加到系统桌面"
|
||||
Opacity="0.7"
|
||||
FontSize="12"
|
||||
Margin="0,4,0,0" />
|
||||
</StackPanel>
|
||||
xmlns:fi="using:FluentIcons.Avalonia"
|
||||
xmlns:local="using:LanMountainDesktop.Views"
|
||||
x:Class="LanMountainDesktop.Views.FusedDesktopComponentLibraryControl">
|
||||
|
||||
<Grid ColumnDefinitions="220,*">
|
||||
<!-- 分类列表 (左侧) -->
|
||||
<Border Grid.Column="0"
|
||||
BorderBrush="{DynamicResource AdaptiveBorderBrush}"
|
||||
BorderThickness="0,0,1,0"
|
||||
Padding="12,0,12,12">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<TextBox x:Name="SearchBox"
|
||||
Watermark="搜索组件..."
|
||||
Margin="0,0,0,12"
|
||||
Classes="clear"
|
||||
Background="{DynamicResource AdaptiveSurfaceLowBrush}"
|
||||
CornerRadius="12"
|
||||
Padding="12,8">
|
||||
<TextBox.InnerLeftContent>
|
||||
<fi:SymbolIcon Symbol="Search" FontSize="16" Margin="10,0,0,0" Opacity="0.5" />
|
||||
</TextBox.InnerLeftContent>
|
||||
</TextBox>
|
||||
|
||||
<ListBox x:Name="CategoryListBox"
|
||||
Grid.Row="1"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="OnCategorySelectionChanged">
|
||||
<ListBox.Styles>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="CornerRadius" Value="14" />
|
||||
<Setter Property="Margin" Value="0,2" />
|
||||
<Setter Property="Padding" Value="12,10" />
|
||||
</Style>
|
||||
</ListBox.Styles>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="local:LibraryCategoryItem">
|
||||
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||
<fi:SymbolIcon Symbol="{Binding Icon}" FontSize="18" />
|
||||
<TextBlock Text="{Binding DisplayName}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 组件列表 -->
|
||||
<ScrollViewer Grid.Row="1"
|
||||
Padding="12">
|
||||
<WrapPanel x:Name="ComponentPanel" Orientation="Horizontal" />
|
||||
<!-- 组件网格 (右侧) -->
|
||||
<ScrollViewer Grid.Column="1" Padding="20">
|
||||
<ItemsControl x:Name="ComponentItemsControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="local:LibraryComponentItem">
|
||||
<Button Classes="unstyled-card"
|
||||
Width="260"
|
||||
Margin="0,0,16,16"
|
||||
Padding="0"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="OnAddComponentClick"
|
||||
Tag="{Binding Id}">
|
||||
<Border Classes="card"
|
||||
Background="{DynamicResource AdaptiveSurfaceLowBrush}"
|
||||
BorderBrush="{DynamicResource AdaptiveBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="24"
|
||||
ClipToBounds="True">
|
||||
<Grid RowDefinitions="Auto,Auto">
|
||||
<!-- 预览区域 (动态填充预览) -->
|
||||
<Border x:Name="PreviewHost"
|
||||
Height="150"
|
||||
Background="{DynamicResource AdaptiveSurfaceNeutralBrush}"
|
||||
Margin="8"
|
||||
CornerRadius="16"
|
||||
ClipToBounds="True">
|
||||
<Panel>
|
||||
<!-- 这里将显示组件的缩放预览 -->
|
||||
<ContentPresenter Content="{Binding PreviewContent}" />
|
||||
|
||||
<!-- 空状态或加载中图标 -->
|
||||
<fi:SymbolIcon Symbol="Cube"
|
||||
FontSize="32"
|
||||
Opacity="0.1"
|
||||
IsVisible="{Binding !HasPreview}" />
|
||||
</Panel>
|
||||
</Border>
|
||||
|
||||
<!-- 文字说明 -->
|
||||
<StackPanel Grid.Row="1" Margin="16,8,16,16" Spacing="4">
|
||||
<TextBlock Text="{Binding DisplayName}"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="15" />
|
||||
<TextBlock Text="{Binding Description}"
|
||||
Opacity="0.6"
|
||||
FontSize="12"
|
||||
TextWrapping="Wrap"
|
||||
MaxLines="2" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user