feat: 样式补充

master
tongg 7 months ago
parent bfb345539c
commit f17e20e3f0
  1. 11
      Language/zh_CN.xaml
  2. 3
      Resource/Document/log.txt
  3. 1
      SparkClient.sln.DotSettings.user
  4. 14
      Views/BaseWindow/BaseControl.xaml
  5. 10
      Views/Configuration/ConfigMenuPage.xaml
  6. 5
      Views/Dialog/ExportDialog.xaml
  7. 7
      Views/Dialog/LoadingDialog.xaml
  8. 2
      Views/Dialog/LoadingDialog.xaml.cs
  9. 12
      Views/Dialog/MessageBox.xaml
  10. 461
      Views/Grading/GradingResult.xaml
  11. 180
      Views/Grading/GradingResult.xaml.cs

@ -172,4 +172,15 @@
<sys:String x:Key="LoginWindowExit">退 出 系 统</sys:String> <sys:String x:Key="LoginWindowExit">退 出 系 统</sys:String>
<sys:String x:Key="LoginWindowForgot">如果忘记密码,请联系我们</sys:String> <sys:String x:Key="LoginWindowForgot">如果忘记密码,请联系我们</sys:String>
<!-- 【新】检测结果 -->
<sys:String x:Key="DiamondResultSave">保存</sys:String>
<sys:String x:Key="DiamondResultExport">导出</sys:String>
<sys:String x:Key="DiamondResultDs">DS</sys:String>
<sys:String x:Key="DiamondResultStandard">标准</sys:String>
<sys:String x:Key="DiamondResultShape">形状</sys:String>
<sys:String x:Key="DiamondResultCrown">冠部</sys:String>
<sys:String x:Key="DiamondResultPavilion">亭部</sys:String>
<sys:String x:Key="DiamondResultWeight">重量(ct)</sys:String>
<sys:String x:Key="DiamondResultCutGrade">切工等级</sys:String>
<sys:String x:Key="DiamondResultSymmetryGrade">对称等级</sys:String>
</ResourceDictionary> </ResourceDictionary>

@ -24,3 +24,6 @@
[2024-12-18 17:25:38.182] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) [2024-12-18 17:25:38.182] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000)
[2024-12-19 08:50:34.643] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) [2024-12-19 08:50:34.643] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000)
[2024-12-19 08:54:45.576] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000) [2024-12-19 08:54:45.576] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000)
[2024-12-19 22:00:52.183] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000)
[2024-12-19 22:01:00.827] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000)
[2024-12-19 22:01:33.476] 发生异常: 由于目标计算机积极拒绝,无法连接。 (localhost:5000)

@ -32,6 +32,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageBox_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffdc001c928464b80ad45ffa09b838a3a15e200_003F55_003F1a844f6e_003FMessageBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageBox_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffdc001c928464b80ad45ffa09b838a3a15e200_003F55_003F1a844f6e_003FMessageBox_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARoutedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1a88b4a860176dd5f825206bbebf3ee3d44ff3f058ceed9eb693c1eaa018_003FRoutedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARoutedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1a88b4a860176dd5f825206bbebf3ee3d44ff3f058ceed9eb693c1eaa018_003FRoutedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F955ec549fe664629353c3b5424b6ad6c7dfcec4ab59bae709ab962c228cf45_003FRuntimeType_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F955ec549fe664629353c3b5424b6ad6c7dfcec4ab59bae709ab962c228cf45_003FRuntimeType_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskCompletionSource_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003Ffc_003Fe9092391_003FTaskCompletionSource_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcca5cfb955e146648d91eb22ffe4627a84930_003F7a_003F2d86be72_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcca5cfb955e146648d91eb22ffe4627a84930_003F7a_003F2d86be72_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2c8e7ca976f350cba9836d5565dac56b11e0b56656fa786460eb1395857a6fa_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2c8e7ca976f350cba9836d5565dac56b11e0b56656fa786460eb1395857a6fa_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATriggerAction_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F95b2fd5cb826a0d61aff88f87b258644cfe6df15959e521eb9d6cc8da70dc52_003FTriggerAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATriggerAction_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F95b2fd5cb826a0d61aff88f87b258644cfe6df15959e521eb9d6cc8da70dc52_003FTriggerAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

@ -19,6 +19,14 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="InCloseHoverImageStyle" TargetType="Image">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8.png"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8-1.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="MiniszieHoverImageStyle" TargetType="Image"> <Style x:Key="MiniszieHoverImageStyle" TargetType="Image">
<!-- 默认图片 --> <!-- 默认图片 -->
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/02-2.png"/> <Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/02-2.png"/>
@ -125,12 +133,12 @@
Margin=" 0 0 10 0" Margin=" 0 0 10 0"
HorizontalAlignment="Right" VerticalAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Center"
Background="Transparent" Background="Transparent"
MouseEnter="Border_Close_MouseEnter"
MouseLeave="Border_MouseLeave"
Padding="0" Padding="0"
> >
<Button Background="Transparent" BorderBrush="Transparent" Padding="0" Command="{Binding CloseCommand}"> <Button Background="Transparent" BorderBrush="Transparent" Padding="0" Command="{Binding CloseCommand}">
<Image Source="../../Resource/Images/UIResource/01-8.png" x:Name="ImageClosed" Width="25" Height="45"/> <Image Style="{StaticResource InCloseHoverImageStyle}" x:Name="ImageClosed" Width="25" Height="45"/>
</Button> </Button>
</Border> </Border>
</Grid> </Grid>

@ -77,6 +77,14 @@
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="InCloseHoverImageStyle" TargetType="Image">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8.png"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8-1.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources> </Border.Resources>
<Grid> <Grid>
<Grid.Background> <Grid.Background>
@ -176,7 +184,7 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Button Grid.Row="0" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" Padding="0" Margin="0 5 10 0 " Command="{Binding CloseCommand}"> <Button Grid.Row="0" Background="Transparent" BorderBrush="Transparent" HorizontalAlignment="Right" Padding="0" Margin="0 5 10 0 " Command="{Binding CloseCommand}">
<Image Source="../../Resource/Images/UIResource/01-8.png" x:Name="ImageClosed" Width="25" Height="40"/> <Image Style="{StaticResource InCloseHoverImageStyle}" x:Name="ImageClosed" Width="25" Height="40"/>
</Button> </Button>
<Grid Grid.Row="1"> <Grid Grid.Row="1">

@ -9,7 +9,7 @@
Title="ExportDialog" Height="450" Width="800" Title="ExportDialog" Height="450" Width="800"
WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
WindowState="Maximized"> WindowState="Maximized">
<Border Background="#9C7C5E" Opacity="0.8"> <Border Background="#00BFFF" Opacity="0.4">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
@ -18,7 +18,8 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Grid.Row="1" Text="{DynamicResource waitExport}" FontFamily="PingFangSC-bold" FontSize="36" VerticalAlignment="Center" Background="Transparent" HorizontalAlignment="Center" Foreground="#FFFFFF"/> <TextBlock Grid.Row="1" Text="{DynamicResource waitExport}" FontFamily="PingFangSC-bold" FontWeight="Bold"
FontSize="36" VerticalAlignment="Center" Background="Transparent" HorizontalAlignment="Center" Foreground="#FFFFFF"/>
<hc:CircleProgressBar x:Name="ProgressBar" IsIndeterminate="True" Grid.Row="2" /> <hc:CircleProgressBar x:Name="ProgressBar" IsIndeterminate="True" Grid.Row="2" />
<TextBlock Grid.Row="3" x:Name="Value" Text="准备开始" HorizontalAlignment="Center" Foreground="#FFFFFF"/> <TextBlock Grid.Row="3" x:Name="Value" Text="准备开始" HorizontalAlignment="Center" Foreground="#FFFFFF"/>
</Grid> </Grid>

@ -8,7 +8,7 @@
Title="LoadingDialog" Height="450" Width="800" Title="LoadingDialog" Height="450" Width="800"
WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
WindowState="Maximized"> WindowState="Maximized">
<Border Background="#9C7C5E" Opacity="0.8"> <Border Background="#00BFFF" Opacity="0.6">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
@ -16,8 +16,9 @@
<RowDefinition/> <RowDefinition/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Grid.Row="1" Text="{DynamicResource wait}" FontFamily="PingFangSC-bold" FontSize="36" VerticalAlignment="Center" Background="Transparent" HorizontalAlignment="Center" Foreground="#FFFFFF"/> <TextBlock Grid.Row="1" Text="{DynamicResource wait}" FontFamily="PingFangSC-bold" FontWeight="Bold"
<ProgressBar x:Name="ProgressBar" Style="{StaticResource ProgressBarWarning}" Grid.Row="2" Width="544"/> FontSize="36" VerticalAlignment="Center" Background="Transparent" HorizontalAlignment="Center" Foreground="#FFFFFF"/>
<ProgressBar x:Name="ProgressBar" Style="{StaticResource ProgressBarSuccess}" Height="25" FontSize="16" Grid.Row="2" Width="544"/>
</Grid> </Grid>
</Border> </Border>
</Window> </Window>

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@ -26,6 +27,7 @@ namespace SparkClient.Views.Dialog
this.MinHeight = 1000; this.MinHeight = 1000;
} }
public void setValue(int i) public void setValue(int i)
{ {
ProgressBar.Value = i; ProgressBar.Value = i;

@ -10,6 +10,16 @@
Background="Transparent" Background="Transparent"
ResizeMode="NoResize" ResizeMode="NoResize"
Title="MessageBox" Height="Auto" Width="600"> Title="MessageBox" Height="Auto" Width="600">
<Window.Resources>
<Style x:Key="CloseHoverImageStyle" TargetType="Image">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8.png"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8-1.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown">
<Border CornerRadius="20" <Border CornerRadius="20"
BorderThickness="1" BorderThickness="1"
@ -24,7 +34,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Button Grid.Row="0" Background="Transparent" BorderBrush="Transparent" Height="32" Width="32" Click="CloseButton_OnClick" <Button Grid.Row="0" Background="Transparent" BorderBrush="Transparent" Height="32" Width="32" Click="CloseButton_OnClick"
HorizontalAlignment="Right" Padding="0" Margin="0 0 15 0 " x:Name="CloseButton" > HorizontalAlignment="Right" Padding="0" Margin="0 0 15 0 " x:Name="CloseButton" >
<Image Source="../../Resource/Images/UIResource/01-8.png" Width="30" Height="30" /> <Image Style="{StaticResource CloseHoverImageStyle}" Width="30" Height="30" />
</Button> </Button>
<TextBlock Grid.Row="1" Width="600" TextWrapping = "Wrap" Padding="30 0" HorizontalAlignment="Center" <TextBlock Grid.Row="1" Width="600" TextWrapping = "Wrap" Padding="30 0" HorizontalAlignment="Center"

@ -8,9 +8,42 @@
xmlns:hx="http://helix-toolkit.org/wpf/SharpDX" xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
xmlns:userControl="clr-namespace:SparkClient.Views.UserControl" xmlns:userControl="clr-namespace:SparkClient.Views.UserControl"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignWidth="1000" d:DesignWidth="2000"
d:DesignHeight="600" d:DesignHeight="600"
> >
<Border.Resources>
<Style x:Key="BorderRowStyle" TargetType="Border">
<Setter Property="CornerRadius" Value="15" />
<Setter Property="Background" Value="#ffffff" />
<Setter Property="Padding" Value="5 10" />
<Setter Property="Margin" Value="2 3" />
</Style>
<Style x:Key="CustomDataGridRowStyle" TargetType="DataGridRow">
<Setter Property="Background" Value="#f0f1f6"/>
<Setter Property="Margin" Value="0,0,0,2"/>
<Setter Property="Height" Value="50"/>
</Style>
<Style x:Key="CustomColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="CustomDataGridCellStyle" TargetType="DataGridCell">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="CenteredTextBlockStyle" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Border.Resources>
<Grid > <Grid >
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="300" Width="5*" /> <ColumnDefinition MinWidth="300" Width="5*" />
@ -19,154 +52,259 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Background="White" Height="70"> <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource BorderRowStyle}">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" /> <!-- 保存 -->
<ColumnDefinition Width="1*" /> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10*"/> <!-- 导出 -->
<ColumnDefinition Width="2*" /> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2*" /> <!-- DS -->
<ColumnDefinition Width="Auto"/>
<!-- 间隔 -->
<ColumnDefinition Width="*"/>
<!-- 标准 -->
<ColumnDefinition Width="Auto"/>
<!-- 形状 -->
<ColumnDefinition Width="Auto"/>
<!-- 管部 -->
<ColumnDefinition Width="Auto"/>
<!-- 亭部 -->
<ColumnDefinition Width="Auto"/>
<!-- 重量 -->
<ColumnDefinition Width="Auto"/>
<!-- 切工等级 -->
<ColumnDefinition Width="Auto"/>
<!-- 对称等级 -->
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <!-- 保存按钮 -->
<RowDefinition Height="1*"></RowDefinition> <Button Grid.Column="0" Padding="0" Margin="10 0 0 0" Height="50" BorderThickness="0"
<RowDefinition Height="1*"></RowDefinition> Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding SaveFileCommand}">
</Grid.RowDefinitions> <Border
<Button Content="{DynamicResource SaveAs}" Foreground="#ffffff" Background="#A7896F" Width="70" Command="{Binding SaveFileCommand}"/> HorizontalAlignment="Center"
<Button Grid.Column="1" Content="{DynamicResource Export}" Foreground="#ffffff" Background="#A7896F" Width="70" Command="{Binding SaveAsCommand}"/> VerticalAlignment="Center"
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="#bbbbbb" Margin="1"> Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#38C8BF" Offset="0"/>
<GradientStop Color="#1FB2A9" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock FontSize="18" TextAlignment="Center" Foreground="#ffffff" Text="{StaticResource DiamondResultSave}" />
</Border>
</Button>
<!-- 导出按钮 -->
<Button Grid.Column="1" Padding="0" Margin="10 0" Height="50" BorderThickness="0"
Background="Transparent" FocusVisualStyle="{x:Null}" Command="{Binding SaveAsCommand}">
<Border
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0 0 0 0"
Padding="10, 10"
Width="100"
BorderThickness="0"
CornerRadius="20">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#40B1FF" Offset="0"/>
<GradientStop Color="#3C9CE6" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock FontSize="18" TextAlignment="Center" Foreground="#ffffff" Text="{StaticResource DiamondResultExport}" />
</Border>
</Button>
<!-- DS 下拉列表 -->
<Border Grid.Column="2" Background="#E0E2EE" Width="170" Height="40" CornerRadius="10" >
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/> <ColumnDefinition Width="*" />
<ColumnDefinition Width="7*"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="DS" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock Grid.Column="1" Text="{StaticResource DiamondResultDs}" TextAlignment="Center" VerticalAlignment="Center"
<ComboBox Grid.Column="1" ItemsSource="{Binding DSList}" FontSize="16"/>
DisplayMemberPath="Key" SelectedValuePath="Value" SelectedValue="{Binding DS, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> <ComboBox Grid.Column="2" ItemsSource="{Binding DSList}" DisplayMemberPath="Key" SelectedValuePath="Value"
SelectedValue="{Binding DS, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Margin="10 0 0 0" FontSize="16" Width="80" BorderBrush="Black" BorderThickness="0" Height="30"/>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Column="2" Grid.Row="0" Background="#E7E7E7" BorderBrush="#BBBBBB" CornerRadius="3" BorderThickness="1"> <!-- 卡片 -->
<!-- 标准 -->
<Border Grid.Column="4" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.RowDefinitions>
<ColumnDefinition/> <RowDefinition Height="*"/>
<ColumnDefinition/> <RowDefinition Height="Auto"/>
<ColumnDefinition/> <RowDefinition Height="Auto"/>
<ColumnDefinition/> <RowDefinition Height="*"/>
<ColumnDefinition/> </Grid.RowDefinitions>
</Grid.ColumnDefinitions> <TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultStandard}"
<TextBlock Grid.Column="0" Text="{DynamicResource Standard}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Column="1" Text="{DynamicResource Shape}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> <TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding Standard}"
<TextBlock Grid.Column="2" Text="{DynamicResource Crown}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> FontSize="20" Foreground="#0063FF"/>
<TextBlock Grid.Column="3" Text="{DynamicResource Pav}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/>
<TextBlock Grid.Column="4" Text="{DynamicResource Wight}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Column="2" Grid.Row="1" Background="Transparent" BorderBrush="#D9D9D9" CornerRadius="3" BorderThickness="1"> <!-- 形状 -->
<Border Grid.Column="5" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.RowDefinitions>
<ColumnDefinition/> <RowDefinition Height="*"/>
<ColumnDefinition/> <RowDefinition Height="Auto"/>
<ColumnDefinition/> <RowDefinition Height="Auto"/>
<ColumnDefinition/> <RowDefinition Height="*"/>
<ColumnDefinition/> </Grid.RowDefinitions>
</Grid.ColumnDefinitions> <TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultShape}"
<TextBlock Grid.Column="0" Text="{Binding Standard}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Column="1" Text="{Binding Shape}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> <TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding Shape}"
<TextBlock Grid.Column="2" Text="{Binding CrownType}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> FontSize="20" Foreground="#0063FF"/>
<TextBlock Grid.Column="3" Text="{Binding PavType}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> </Grid>
<TextBlock Grid.Column="4" Text="{Binding Wight}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> </Border>
<!-- 冠部 -->
<Border Grid.Column="6" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultCrown}"
FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding CrownType}"
FontSize="20" Foreground="#0063FF"/>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Column="3" Grid.Row="0" Background="#E7E7E7" BorderBrush="#BBBBBB" CornerRadius="3" BorderThickness="1"> <!-- 亭部 -->
<Border Grid.Column="7" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid> <Grid>
<TextBlock Grid.Column="0" Text="{DynamicResource CutLevel}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> <Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultPavilion}"
FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding PavType}"
FontSize="20" Foreground="#0063FF"/>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Column="3" Grid.Row="1" Background="#d1d1d1" BorderBrush="#BBBBBB" CornerRadius="3" BorderThickness="1"> <!-- 重量 -->
<Border Grid.Column="8" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid> <Grid>
<TextBlock Grid.Column="0" Text="{Binding CutLevelTotal}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False" Foreground="#848484"/> <Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultWeight}"
FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding Wight}"
FontSize="20" Foreground="#0063FF"/>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Column="4" Grid.Row="0" Background="#E7E7E7" BorderBrush="#BBBBBB" CornerRadius="3" BorderThickness="1"> <!-- 切工等级 -->
<Border Grid.Column="9" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid> <Grid>
<TextBlock Grid.Column="0" Text="{DynamicResource SymLevel}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False"/> <Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultCutGrade}"
FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<Border Grid.Row="2" Background="#D6D8E4" CornerRadius="5" Width="100">
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding CutLevelTotal}"
FontSize="20" Foreground="Black" Padding="5"/>
</Border>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Column="4" Grid.Row="1" Background="#d1d1d1" BorderBrush="#BBBBBB" CornerRadius="3" BorderThickness="1"> <!-- 切工等级 -->
<Border Grid.Column="10" Background="#EBEEF5" Width="170" Height="80" CornerRadius="10" Margin="0 0 10 0">
<Grid> <Grid>
<TextBlock Grid.Column="0" Text="{Binding SymLevelTotal}" VerticalAlignment="Center" HorizontalAlignment="Center" IsEnabled="False" Foreground="#848484"/> <Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultSymmetryGrade}"
FontSize="20" Foreground="Black" Margin="0 0 0 5"/>
<Border Grid.Row="2" Background="#D6D8E4" CornerRadius="5" Width="100">
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding SymLevelTotal}"
FontSize="20" Foreground="Black" Padding="5"/>
</Border>
</Grid> </Grid>
</Border> </Border>
</Grid> </Grid>
</Border> </Border>
<Border Grid.Row="1" Grid.Column="0"> <Border Grid.Row="2" Grid.Column="0" Style="{StaticResource BorderRowStyle}" >
<DataGrid HeadersVisibility="Column" AutoGenerateColumns="False" ItemsSource="{Binding DtResults,Mode=TwoWay}" CanUserResizeColumns="False" CanUserResizeRows="False" <DataGrid ItemsSource="{Binding DtResults,Mode=TwoWay}" FontSize="20"
CanUserSortColumns ="False"> AutoGenerateColumns="False"
<DataGrid.ColumnHeaderStyle> HeadersVisibility="Column"
<Style TargetType="DataGridColumnHeader"> Background="Transparent"
<Setter Property="MinWidth" Value="120"/> BorderThickness="0"
<Setter Property="BorderThickness" Value="1,1,1,1"/> GridLinesVisibility="None"
<Setter Property="BorderBrush" Value="#BBBBBB"/> IsReadOnly="True"
<Setter Property="HorizontalContentAlignment" Value="Center"/> RowStyle="{StaticResource CustomDataGridRowStyle}"
</Style> ColumnHeaderStyle="{StaticResource CustomColumnHeaderStyle}"
</DataGrid.ColumnHeaderStyle> CellStyle="{StaticResource CustomDataGridCellStyle}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="1,1,1,1"/>
<Setter Property="BorderBrush" Value="#BBBBBB"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGrid.CellStyle>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
</DataGrid.RowStyle>
<DataGrid.Resources>
<Style x:Key="CenteredTextBlockStyle" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn Width="*" IsReadOnly="True" Header=""> <DataGridTemplateColumn Header="" Width="*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border MouseLeftButtonDown="dataGrid_MouseLeftButtonUp">
<TextBlock Text="{Binding TestItemName}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="*" IsReadOnly="True" Header="{DynamicResource resAvg}" Binding="{Binding Avg}" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Width="*" IsReadOnly="True" Header="{DynamicResource resDev}" Binding="{Binding Dev}" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Width="*" IsReadOnly="True" Header="{DynamicResource resMin}" Binding="{Binding Min}" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Width="*" IsReadOnly="True" Header="{DynamicResource resMax}" Binding="{Binding Max}" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Width="*" IsReadOnly="True" Header="{DynamicResource CutLevel}" Binding="{Binding CutLevel}" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTemplateColumn Width="*" Header="{DynamicResource resLevel}">
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ComboBox ItemsSource="{Binding GradeList}" IsEnabled="{Binding isEnabled}" <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
DisplayMemberPath="Key" SelectedValuePath="Value" SelectedValue="{Binding SymLevel, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectionChanged="ChangSymLevel"/> <TextBlock Text="{Binding TestItemName}"
</DataTemplate> HorizontalAlignment="Center"
</DataGridTemplateColumn.CellTemplate> VerticalAlignment="Center"/>
</DataGridTemplateColumn>
<DataGridTextColumn Header="TestItemId" Binding="{Binding TestItemId}" Visibility="Hidden"/> <Popup x:Name="RowPopup"
</DataGrid.Columns> Placement="Bottom"
</DataGrid> AllowsTransparency="True"
</Border> PlacementTarget="{Binding RelativeSource={RelativeSource AncestorType=FrameworkElement}}"
<Popup x:Name="detailPopup" IsOpen="False" Placement="Absolute" Width="1200"> Visibility="Collapsed"
<Grid Background="#ededed"> VerticalOffset="20"
<Grid.ColumnDefinitions> HorizontalOffset="80">
<ColumnDefinition Width="117*"/> <Border Width="1200" Height="100" Background="White" CornerRadius="5">
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions> <Grid>
<DataGrid x:Name="RowDetail" CanUserResizeColumns="False" CanUserResizeRows="False"> <Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" HorizontalAlignment="Right" Margin="5" Click="CloseAllPopup_Click" Padding="0" BorderBrush="Transparent"
Background="Transparent" BorderThickness="0">
<Image Source="pack://application:,,,/Resource/Images/UIResource/01-8.png" MouseLeave="UIElement_OnMouseLeave" MouseEnter="UIElement_OnMouseEnter" Width="30" />
</Button>
<!-- <Grid Grid.Row="1"> -->
<!-- <Grid.ColumnDefinitions> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- <ColumnDefinition Width="Auto"/> -->
<!-- </Grid.ColumnDefinitions> -->
<!-- -->
<!-- </Grid> -->
<Grid Grid.Row="1">
<DataGrid x:Name="RowDetail" CanUserResizeColumns="False" CanUserResizeRows="False" FontSize="16">
<DataGrid.ColumnHeaderStyle> <DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader"> <Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
@ -346,19 +484,66 @@
<DataGridTextColumn Width="*" Header="{DynamicResource resLevel}" Binding="{Binding SymLevel}" ElementStyle="{StaticResource CenteredTextBlockStyle}" CellStyle="{StaticResource OtherCellkStyle}"/> <DataGridTextColumn Width="*" Header="{DynamicResource resLevel}" Binding="{Binding SymLevel}" ElementStyle="{StaticResource CenteredTextBlockStyle}" CellStyle="{StaticResource OtherCellkStyle}"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Button Grid.Column="1" Click="Window_MouseDown" VerticalAlignment="Top" Background="Transparent">
<Path Data="{StaticResource CloseGeometry}"
Fill="Black"
Stroke="Black"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Margin="0 0 0 0"
Width="10" />
</Button>
</Grid> </Grid>
</Grid>
</Border>
</Popup> </Popup>
<GridSplitter Grid.Row="1" Grid.Column="1" Width="3" HorizontalAlignment="Stretch"></GridSplitter>
<Border Grid.Row="1" Grid.Column="2" Background="White"> <!-- 点击区域,触发打开(或切换) Popup 事件 -->
<Border x:Name="ClickArea"
Background="Transparent"
MouseLeftButtonUp="ClickArea_MouseLeftButtonUp"/>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- 第2~5列 -->
<DataGridTextColumn Header="平均值" Binding="{Binding Avg}" Width="*" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Header="偏差值" Binding="{Binding Dev}" Width="*" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Header="偏差值" Binding="{Binding Min}" Width="*" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<DataGridTextColumn Header="偏差值" Binding="{Binding Max}" Width="*" ElementStyle="{StaticResource CenteredTextBlockStyle}"/>
<!-- 第6列 -->
<DataGridTextColumn Header="切工等级" Binding="{Binding CutLevel}" Width="*">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Blue"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<!-- 第五列:SYM等级,下拉框示例,可编辑 -->
<DataGridTemplateColumn Width="*" Header="{DynamicResource resLevel}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding GradeList}"
IsEnabled="{Binding isEnabled}"
DisplayMemberPath="Key"
SelectedValuePath="Value"
SelectedValue="{Binding SymLevel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectionChanged="ChangSymLevel"
FontSize="20"
Foreground="DarkSlateGray"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="150">
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="TestItemId" Binding="{Binding TestItemId}" Visibility="Hidden"/>
</DataGrid.Columns>
</DataGrid>
</Border>
<GridSplitter Grid.Row="2" Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="Transparent"></GridSplitter>
<Border Grid.Row="2" Grid.Column="2" Background="White" Style="{StaticResource BorderRowStyle}">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<!-- <RowDefinition Height="50"></RowDefinition> --> <!-- <RowDefinition Height="50"></RowDefinition> -->
@ -367,32 +552,6 @@
<userControl:Viewport3D ViewportData="{Binding ViewportData}"></userControl:Viewport3D> <userControl:Viewport3D ViewportData="{Binding ViewportData}"></userControl:Viewport3D>
<!-- <Border Grid.Row="0" Background="Fuchsia" /> -->
<!-- <Border Grid.Row="1" BorderThickness="1" CornerRadius="0" BorderBrush="Black" Margin="5"> -->
<!-- <hx:Viewport3DX Grid.Column="0" x:Name="Viewport3Dx" MouseLeftButtonDown="Viewport3Dx_OnMouseLeftButtonDown" ClipToBounds="True"> -->
<!-- <hx:Viewport3DX.InputBindings> -->
<!-- <KeyBinding Key="B" Command="hx:ViewportCommands.BackView" /> -->
<!-- <KeyBinding Key="F" Command="hx:ViewportCommands.FrontView" /> -->
<!-- <KeyBinding Key="U" Command="hx:ViewportCommands.TopView" /> -->
<!-- <KeyBinding Key="D" Command="hx:ViewportCommands.BottomView" /> -->
<!-- <KeyBinding Key="L" Command="hx:ViewportCommands.LeftView" /> -->
<!-- <KeyBinding Key="R" Command="hx:ViewportCommands.RightView" /> -->
<!-- <KeyBinding Command="hx:ViewportCommands.ZoomExtents" Gesture="Control+E" /> -->
<!-- <MouseBinding Command="hx:ViewportCommands.Rotate" Gesture="RightClick" /> -->
<!-- <MouseBinding Command="hx:ViewportCommands.Zoom" Gesture="MiddleClick" /> -->
<!-- <MouseBinding Command="hx:ViewportCommands.Pan" Gesture="LeftClick" /> -->
<!-- </hx:Viewport3DX.InputBindings> -->
<!-- ~1~ <hx:DirectionalLight3D x:Name="MainDirectionalLight" /> @1@ -->
<!-- ~1~ <hx:PointLight3D x:Name="MainPointLight" /> @1@ -->
<!-- ~1~ <hx:AmbientLight3D x:Name="AmbientLight" /> @1@ -->
<!-- ~1~ <hx:AxisPlaneGridModel3D @1@ -->
<!-- ~1~ AutoSpacing="false" @1@ -->
<!-- ~1~ RenderShadowMap="true" @1@ -->
<!-- ~1~ Offset="-65" /> @1@ -->
<!-- </hx:Viewport3DX> -->
<!-- </Border> -->
</Grid> </Grid>

@ -1,7 +1,9 @@
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging;
using SparkClient.ViewModel.Grading; using SparkClient.ViewModel.Grading;
using GeometryModel3D = HelixToolkit.Wpf.SharpDX.GeometryModel3D; using GeometryModel3D = HelixToolkit.Wpf.SharpDX.GeometryModel3D;
@ -11,10 +13,15 @@ public partial class GradingResult
{ {
// List<Viewport3DTriangleEntity> triangles = new List<Viewport3DTriangleEntity>(); // List<Viewport3DTriangleEntity> triangles = new List<Viewport3DTriangleEntity>();
List<GeometryModel3D> mouseAddModels = new List<GeometryModel3D>(); List<GeometryModel3D> mouseAddModels = new List<GeometryModel3D>();
// 用于记录当前所有已存在的Popup
private List<Popup> _allPopups = new List<Popup>();
public GradingResult() public GradingResult()
{ {
InitializeComponent(); InitializeComponent();
// 在Window最外层捕获鼠标点击,判断是否点击在Popup之外,如果是则关闭所有Popup
this.PreviewMouseLeftButtonDown += Window_PreviewMouseLeftButtonDown;
//DataContext = new GradingResultVM(null); //DataContext = new GradingResultVM(null);
// this.Viewport3Dx.EffectsManager = new DefaultEffectsManager(); // this.Viewport3Dx.EffectsManager = new DefaultEffectsManager();
@ -121,37 +128,37 @@ public partial class GradingResult
d.ChangeSym(null); d.ChangeSym(null);
} }
private void dataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) // private void dataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ // {
detailPopup.IsOpen = false; // detailPopup.IsOpen = false;
// 获取点击的目标元素 // // 获取点击的目标元素
var element = sender as FrameworkElement; // var element = sender as FrameworkElement;
//
var cell = FindVisualParent<DataGridCell>(element); // var cell = FindVisualParent<DataGridCell>(element);
if (cell == null) return; // if (cell == null) return;
//
var row = FindVisualParent<DataGridRow>(cell); // var row = FindVisualParent<DataGridRow>(cell);
if (row == null) return; // if (row == null) return;
//
if (element != null) // if (element != null)
{ // {
// 将 firstCell 的边界转换为屏幕坐标系 // // 将 firstCell 的边界转换为屏幕坐标系
var firstCellBounds = cell.PointToScreen(new Point(0, 0)); // var firstCellBounds = cell.PointToScreen(new Point(0, 0));
//
// 计算Popup的位置 // // 计算Popup的位置
var popupPosition = new Point(firstCellBounds.X + cell.RenderSize.Width, firstCellBounds.Y + cell.RenderSize.Height); // var popupPosition = new Point(firstCellBounds.X + cell.RenderSize.Width, firstCellBounds.Y + cell.RenderSize.Height);
var selectObject = row.Item as DataInfo; // var selectObject = row.Item as DataInfo;
string testItemId = selectObject.TestItemId; // string testItemId = selectObject.TestItemId;
var d = DataContext as GradingResultVM; // var d = DataContext as GradingResultVM;
RowDetail rowDetail = d.getSelectData(testItemId); // RowDetail rowDetail = d.getSelectData(testItemId);
// 设置Popup的位置 // // 设置Popup的位置
detailPopup.HorizontalOffset = popupPosition.X; // detailPopup.HorizontalOffset = popupPosition.X;
detailPopup.VerticalOffset = popupPosition.Y; // detailPopup.VerticalOffset = popupPosition.Y;
detailPopup.IsOpen = true; // detailPopup.IsOpen = true;
RowDetail.Items.Clear(); // RowDetail.Items.Clear();
RowDetail.Items.Add(rowDetail); // RowDetail.Items.Add(rowDetail);
} // }
} // }
// 辅助方法:查找父元素 // 辅助方法:查找父元素
private T FindVisualParent<T>(DependencyObject child) where T : DependencyObject private T FindVisualParent<T>(DependencyObject child) where T : DependencyObject
{ {
@ -167,13 +174,116 @@ public partial class GradingResult
return FindVisualParent<T>(parentObject); return FindVisualParent<T>(parentObject);
} }
} }
private void Window_MouseDown(object sender, MouseButtonEventArgs e) // private void Window_MouseDown(object sender, MouseButtonEventArgs e)
// {
// detailPopup.IsOpen = false;
// }
//
// private void Window_MouseDown(object sender, RoutedEventArgs e)
// {
// detailPopup.IsOpen = false;
// }
private void ClickArea_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ {
detailPopup.IsOpen = false; var border = sender as Border;
if (border == null) return;
var parentGrid = border.Parent as Grid;
if (parentGrid == null) return;
var popup = parentGrid.FindName("RowPopup") as Popup;
if (popup == null) return;
// 先关闭所有已显示的 Popup
CloseAllPopups();
// 将此Popup记录到集合中,并打开
if (!_allPopups.Contains(popup))
{
_allPopups.Add(popup);
} }
private void Window_MouseDown(object sender, RoutedEventArgs e) // 显示新Popup
popup.IsOpen = true;
popup.Visibility = Visibility.Visible;
}
private void CloseAllPopups()
{ {
detailPopup.IsOpen = false; foreach (var p in _allPopups)
{
p.IsOpen = false;
p.Visibility = Visibility.Collapsed;
}
}
private void CloseAllPopup_Click(object sender, RoutedEventArgs e)
{
CloseAllPopups();
}
private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// originalSource 是点击处的控件
var clickedElement = e.OriginalSource as DependencyObject;
// 遍历所有已知 Popup
bool isClickOnAnyPopup = false;
foreach (var p in _allPopups)
{
// 如果此 Popup 不可见或未打开,就不用检查了
if (!p.IsOpen)
continue;
// 判断点击处是否在此 Popup 内
if (IsDescendantOf(p.Child, clickedElement))
{
// 找到一个 Popup 包含这个点击
isClickOnAnyPopup = true;
break;
}
}
// 如果没点击到任何 Popup,就关闭全部
if (!isClickOnAnyPopup)
{
CloseAllPopups();
}
}
private bool IsDescendantOf(DependencyObject parent, DependencyObject clicked)
{
if (parent == null || clicked == null)
return false;
// 从 clicked 开始不断向上找 VisualTree
var current = clicked;
while (current != null)
{
if (current == parent)
{
return true;
}
current = VisualTreeHelper.GetParent(current);
}
return false;
}
private void UIElement_OnMouseLeave(object sender, MouseEventArgs e)
{
if (sender is Image image)
{
image.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/UIResource/01-8.png"));
}
}
private void UIElement_OnMouseEnter(object sender, MouseEventArgs e)
{
if (sender is Image image)
{
image.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/UIResource/01-8-1.png"));
}
} }
} }
Loading…
Cancel
Save