170 lines
7.7 KiB
XML
170 lines
7.7 KiB
XML
<ui:FluentWindow
|
|
x:Class="BoreholeExtract.MainWindow"
|
|
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:BoreholeExtract"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
|
Title="提取钻孔信息"
|
|
Width="1000"
|
|
Height="600"
|
|
d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
|
|
ui:Design.Background="{StaticResource WindowBackground}"
|
|
mc:Ignorable="d">
|
|
<Window.Resources>
|
|
<!-- 核心:定义 CategoryWrapper 长什么样 -->
|
|
<DataTemplate DataType="{x:Type local:CategoryWrapper}">
|
|
|
|
<!-- 这里就是你的卡片样式,只写一次 -->
|
|
<ui:Card
|
|
Width="300"
|
|
Margin="0,0,16,16"
|
|
Padding="16"
|
|
VerticalAlignment="Top">
|
|
<StackPanel>
|
|
<!-- 标题 -->
|
|
<Grid Margin="0,0,0,12">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock
|
|
FontSize="16"
|
|
FontWeight="SemiBold"
|
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
|
Text="{Binding Title}" />
|
|
|
|
<ui:SymbolIcon
|
|
Grid.Column="1"
|
|
FontSize="18"
|
|
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
|
Symbol="Tag24" />
|
|
</Grid>
|
|
<!-- 标签列表 -->
|
|
<ItemsControl
|
|
Margin="0,0,0,12"
|
|
d:ItemsSource="{d:SampleData ItemCount=5}"
|
|
ItemsSource="{Binding Items}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel Orientation="Horizontal" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border
|
|
Margin="0,0,6,6"
|
|
Padding="8,4"
|
|
Background="{DynamicResource ControlFillColorSecondaryBrush}"
|
|
CornerRadius="4">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontSize="13"
|
|
Text="{Binding}" />
|
|
<!-- 删除按钮 -->
|
|
<ui:Button
|
|
Width="20"
|
|
Height="20"
|
|
Margin="6,0,0,0"
|
|
Padding="0"
|
|
Appearance="Transparent"
|
|
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ui:Card}}"
|
|
CommandParameter="{Binding}"
|
|
Foreground="{DynamicResource SystemFillColorCriticalBrush}">
|
|
<ui:Button.Icon>
|
|
<ui:SymbolIcon Symbol="Dismiss24" />
|
|
</ui:Button.Icon>
|
|
</ui:Button>
|
|
</StackPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<!-- 输入框 -->
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<ui:TextBox PlaceholderText="输入并回车..." Text="{Binding InputText, UpdateSourceTrigger=PropertyChanged}">
|
|
<ui:TextBox.InputBindings>
|
|
<KeyBinding Key="Enter" Command="{Binding AddCommand}" />
|
|
</ui:TextBox.InputBindings>
|
|
<!-- 显式设置 TextBox 图标 -->
|
|
<ui:TextBox.Icon>
|
|
<ui:SymbolIcon Symbol="Edit24" />
|
|
</ui:TextBox.Icon>
|
|
</ui:TextBox>
|
|
|
|
<ui:Button
|
|
Grid.Column="1"
|
|
Margin="8,0,0,0"
|
|
Appearance="Secondary"
|
|
Command="{Binding AddCommand}">
|
|
<ui:Button.Icon>
|
|
<ui:SymbolIcon Symbol="Add24" />
|
|
</ui:Button.Icon>
|
|
</ui:Button>
|
|
</Grid>
|
|
</StackPanel>
|
|
</ui:Card>
|
|
|
|
</DataTemplate>
|
|
</Window.Resources>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<ui:TitleBar Title="钻孔数据提取" VerticalAlignment="Top" />
|
|
|
|
<ScrollViewer Grid.Row="1" Margin="5">
|
|
<!-- ItemsControl 负责根据 DashboardItems 列表生成上面的 DataTemplate -->
|
|
<ItemsControl d:ItemsSource="{d:SampleData ItemCount=5}" ItemsSource="{Binding DashboardItems}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<!-- 流式布局,自动换行 -->
|
|
<WrapPanel Orientation="Horizontal" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
<Grid
|
|
Grid.Row="2"
|
|
Height="150"
|
|
Margin="10">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock VerticalAlignment="Center" Text="消息:" />
|
|
<ListBox
|
|
x:Name="LogBox"
|
|
Grid.Column="1"
|
|
BorderThickness="1"
|
|
ItemsSource="{Binding Logs}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Foreground="LightSlateGray" Text="{Binding}" />
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
<UniformGrid
|
|
Grid.Column="2"
|
|
Margin="5"
|
|
Columns="1">
|
|
<Button
|
|
Margin="5"
|
|
Command="{Binding SaveConfigCommand}"
|
|
Content="保存配置" />
|
|
<Button Command="{Binding ExtractCommand}" Content="读取文件" />
|
|
</UniformGrid>
|
|
</Grid>
|
|
</Grid>
|
|
</ui:FluentWindow>
|