276 lines
8.8 KiB
XML
276 lines
8.8 KiB
XML
<tf:WindowBase
|
|
x:Class="Main.Test.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:Main.Test"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:tf="Trade.Framework"
|
|
xmlns:vm="clr-namespace:Main.Test.ViewModels"
|
|
Title="复杂表格 · 运行测试"
|
|
Width="1380"
|
|
Height="820"
|
|
MinWidth="900"
|
|
MinHeight="500"
|
|
DataContext="{tf:DISource Type=vm:MainViewModel}"
|
|
WindowStartupLocation="CenterScreen"
|
|
mc:Ignorable="d">
|
|
<tf:WindowBase.Resources>
|
|
<Style x:Key="ActionButton" TargetType="Button">
|
|
<Setter Property="Padding" Value="9,4" />
|
|
<Setter Property="Margin" Value="0,0,6,0" />
|
|
<Setter Property="MinWidth" Value="48" />
|
|
</Style>
|
|
<ContextMenu x:Key="OrderRowMenu" DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
|
|
<MenuItem
|
|
Command="{Binding PlacementTarget.Tag.DetailCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
CommandParameter="{Binding}"
|
|
Header="查看详情" />
|
|
<MenuItem
|
|
Command="{Binding PlacementTarget.Tag.ConfirmCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
CommandParameter="{Binding}"
|
|
Header="确认 / 撤销确认" />
|
|
<Separator />
|
|
<MenuItem
|
|
Command="{Binding PlacementTarget.Tag.CopyCodeCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
|
CommandParameter="{Binding}"
|
|
Header="复制编码" />
|
|
</ContextMenu>
|
|
</tf:WindowBase.Resources>
|
|
<Grid Margin="16">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<DockPanel Margin="0,0,0,12">
|
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
|
<ComboBox
|
|
x:Name="ImageMode"
|
|
Width="155"
|
|
Margin="0,0,8,0"
|
|
VerticalContentAlignment="Center"
|
|
SelectedIndex="0">
|
|
<ComboBoxItem Content="本地图片" Tag="0" />
|
|
<ComboBoxItem Content="Picsum 160px" Tag="160" />
|
|
<ComboBoxItem Content="Picsum 800px" Tag="800" />
|
|
</ComboBox>
|
|
<ComboBox
|
|
x:Name="DataSize"
|
|
Width="115"
|
|
Margin="0,0,8,0"
|
|
VerticalContentAlignment="Center"
|
|
SelectedIndex="1">
|
|
<ComboBoxItem Content="1,000 行" Tag="1000" />
|
|
<ComboBoxItem Content="10,000 行" Tag="10000" />
|
|
<ComboBoxItem Content="50,000 行" Tag="50000" />
|
|
</ComboBox>
|
|
<Button
|
|
x:Name="LoadButton"
|
|
Click="LoadData_Click"
|
|
Content="加载数据"
|
|
Style="{StaticResource ActionButton}" />
|
|
<Button
|
|
x:Name="ImageBenchmarkButton"
|
|
Click="ImageBenchmark_Click"
|
|
Content="图片滚动测试"
|
|
Style="{StaticResource ActionButton}" />
|
|
<Button
|
|
x:Name="BenchmarkButton"
|
|
Click="Benchmark_Click"
|
|
Content="运行性能测试"
|
|
Style="{StaticResource ActionButton}" />
|
|
</StackPanel>
|
|
<StackPanel>
|
|
<TextBlock
|
|
FontSize="20"
|
|
FontWeight="SemiBold"
|
|
Text="订单工作台 / 复杂内容测试" />
|
|
<StackPanel Margin="0,5,0,0" Orientation="Horizontal">
|
|
<TextBlock Foreground="#64748B" Text="{Binding Data.Count, StringFormat=共 {0:N0} 行}" />
|
|
<TextBlock
|
|
Margin="12,0,0,0"
|
|
Foreground="#64748B"
|
|
Text="{Binding SelectedCount, StringFormat=已选 {0:N0} 行}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
<local:StyledDataGrid
|
|
x:Name="OrdersGrid"
|
|
Grid.Row="1"
|
|
d:ItemsSource="{d:SampleData ItemCount=10}"
|
|
GridLinesVisibility="Horizontal"
|
|
IsReadOnly="True"
|
|
ItemsSource="{Binding Data}"
|
|
RowContextMenu="{StaticResource OrderRowMenu}"
|
|
RowDetailsVisibilityMode="Collapsed"
|
|
RowHeight="92"
|
|
SelectRowOnRightClick="True"
|
|
SelectedItems="{Binding SelectedItems, Mode=TwoWay}"
|
|
SelectionMode="Extended"
|
|
ShowCheckBox="True"
|
|
ShowRowNumber="True"
|
|
ShowSelectAll="True">
|
|
<local:StyledDataGrid.Columns>
|
|
<DataGridTextColumn
|
|
Width="90"
|
|
Binding="{Binding Code}"
|
|
Header="编码" />
|
|
<DataGridTemplateColumn
|
|
Width="300"
|
|
Header="商品 / 规格"
|
|
SortMemberPath="Name">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Grid Margin="0,7">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="68" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Border
|
|
Width="58"
|
|
Height="58"
|
|
Background="#F1F5F9"
|
|
CornerRadius="6">
|
|
<local:NetworkThumbnail
|
|
Width="58"
|
|
Height="58"
|
|
Placeholder="{Binding Thumbnail}"
|
|
Stretch="Uniform"
|
|
Url="{Binding ThumbnailUrl}" />
|
|
</Border>
|
|
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
|
<TextBlock
|
|
FontWeight="SemiBold"
|
|
Text="{Binding Name}"
|
|
TextTrimming="CharacterEllipsis"
|
|
ToolTip="{Binding Name}" />
|
|
<TextBlock
|
|
Margin="0,5,0,0"
|
|
FontSize="11"
|
|
Opacity="0.65"
|
|
Text="{Binding Sku}" />
|
|
<TextBlock
|
|
Margin="0,4,0,0"
|
|
FontSize="11"
|
|
Opacity="0.65"
|
|
Text="{Binding Shop}" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTextColumn
|
|
Width="90"
|
|
Binding="{Binding Price, StringFormat=N2}"
|
|
CellStyle="{DynamicResource StyledNumberCellStyle}"
|
|
Header="单价 / 元"
|
|
HeaderStyle="{DynamicResource DefaultNumberCellHeaderStyle}" />
|
|
<DataGridTextColumn
|
|
Width="65"
|
|
Binding="{Binding Qty}"
|
|
CellStyle="{DynamicResource StyledNumberCellStyle}"
|
|
Header="数量"
|
|
HeaderStyle="{DynamicResource DefaultNumberCellHeaderStyle}" />
|
|
<DataGridTemplateColumn
|
|
Width="230"
|
|
Header="买家 / 收货信息"
|
|
SortMemberPath="Buyer">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<StackPanel VerticalAlignment="Center">
|
|
<TextBlock FontWeight="SemiBold" Text="{Binding Buyer}" />
|
|
<TextBlock
|
|
Margin="0,6,0,0"
|
|
FontSize="11"
|
|
Opacity="0.7"
|
|
Text="{Binding Address}"
|
|
TextWrapping="Wrap" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn
|
|
Width="95"
|
|
Header="状态"
|
|
SortMemberPath="Status">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<Border
|
|
Padding="8,4"
|
|
HorizontalAlignment="Left"
|
|
Background="#E8F4FF"
|
|
CornerRadius="4">
|
|
<TextBlock
|
|
FontSize="12"
|
|
Foreground="#1769AA"
|
|
Text="{Binding Status}" />
|
|
</Border>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTextColumn
|
|
Width="105"
|
|
Binding="{Binding CreatedAt, StringFormat=MM-dd HH:mm}"
|
|
Header="创建时间" />
|
|
<DataGridTemplateColumn
|
|
Width="165"
|
|
Header="备注"
|
|
SortMemberPath="Remark">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock
|
|
MaxHeight="60"
|
|
VerticalAlignment="Center"
|
|
Text="{Binding Remark}"
|
|
TextWrapping="Wrap" />
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Width="145" Header="操作">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
|
<Button
|
|
Command="{Binding DataContext.DetailCommand, RelativeSource={RelativeSource AncestorType=local:StyledDataGrid}}"
|
|
CommandParameter="{Binding}"
|
|
Content="详情"
|
|
Style="{StaticResource ActionButton}" />
|
|
<Button
|
|
Command="{Binding DataContext.ConfirmCommand, RelativeSource={RelativeSource AncestorType=local:StyledDataGrid}}"
|
|
CommandParameter="{Binding}"
|
|
Content="确认"
|
|
Style="{StaticResource ActionButton}" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
</local:StyledDataGrid.Columns>
|
|
</local:StyledDataGrid>
|
|
<TextBlock
|
|
Grid.Row="2"
|
|
Margin="0,10,0,6"
|
|
Text="{Binding ActionMessage}"
|
|
TextWrapping="Wrap" />
|
|
<Border
|
|
Grid.Row="3"
|
|
Padding="10,8"
|
|
Background="#F1F5F9"
|
|
CornerRadius="5">
|
|
<StackPanel>
|
|
<TextBlock
|
|
x:Name="ImageStatisticsText"
|
|
Margin="0,0,0,4"
|
|
Foreground="#475569"
|
|
TextWrapping="Wrap" />
|
|
<TextBlock
|
|
x:Name="PerformanceText"
|
|
Foreground="#475569"
|
|
Text="选择数据量后运行性能测试:连续滚动 60 次,并测量全选、取消全选及已生成行数。"
|
|
TextWrapping="Wrap" />
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</tf:WindowBase>
|