修复窗口大小问题

This commit is contained in:
ShrlAlgo
2025-09-19 09:18:09 +08:00
parent d71019ac38
commit 3fc465959b
34 changed files with 592 additions and 238 deletions

View File

@@ -1,13 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Szmedi.RevitToolkit.Approval.Controls"
xmlns:converters="clr-namespace:Szmedi.RevitToolkit.Approval.Converters"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Szmedi.RevitToolkit.Approval.Controls"
xmlns:converters="clr-namespace:Szmedi.RevitToolkit.Approval.Converters"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<!-- <materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="Teal" SecondaryColor="Green" /> -->
<ResourceDictionary.MergedDictionaries>
<!-- Set your base theme -->
<!-- Set your base theme -->
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
<!-- Set your control styles -->
<!-- Set your control styles -->
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Green.Primary.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
@@ -15,10 +16,10 @@
<!-- <materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="Teal" SecondaryColor="Green" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/Szmedi.RevitToolkit.Approval;component/Controls/MaterialWindow.xaml" /> -->
<!-- primary color -->
<ResourceDictionary Source="pack://application:,,,/Szmedi.RevitToolkit.Approval;component/Controls/MaterialWindow.xaml" />-->
<!-- primary color -->
<ResourceDictionary>
<!-- include your primary palette -->
<!-- include your primary palette -->
<ResourceDictionary.MergedDictionaries />
<Color x:Key="SZMCColor">#1F9944</Color>
<SolidColorBrush x:Key="SZMCBrush" Color="{StaticResource SZMCColor}" />
@@ -34,7 +35,7 @@
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<converters:IntToBooleanConverter x:Key="IntToBooleanConverter" />
<FontFamily x:Key="SourceHanSansSC">pack://application:,,,/Szmedi.RevitToolkit.Approval;component/Fonts/#Source Han Sans SC</FontFamily>
<!--<FontFamily x:Key="SourceHanSansSC">pack://application:,,,/Szmedi.RevitToolkit.Approval;component/Fonts/#Source Han Sans SC</FontFamily>-->
<Style x:Key="ExpanderStyle" TargetType="Expander">
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />
<Setter Property="BorderThickness" Value="0" />
@@ -44,17 +45,22 @@
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<DockPanel LastChildFill="True">
<ToggleButton
ClickMode="Press"
Content="{TemplateBinding Header}"
DockPanel.Dock="Top"
Foreground="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource MaterialDesignHorizontalHeaderStyle}" />
<Rectangle Height="1" DockPanel.Dock="Top" HorizontalAlignment="Stretch" Fill="{StaticResource SZMCBrush}"/>
<Border Margin="10"
Name="ContentSite"
Visibility="Collapsed">
<ToggleButton
ClickMode="Press"
Content="{TemplateBinding Header}"
DockPanel.Dock="Top"
Foreground="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource MaterialDesignHorizontalHeaderStyle}" />
<Rectangle
Height="1"
HorizontalAlignment="Stretch"
DockPanel.Dock="Top"
Fill="{StaticResource SZMCBrush}" />
<Border
Name="ContentSite"
Margin="10"
Visibility="Collapsed">
<ContentPresenter />
</Border>
</DockPanel>
@@ -71,9 +77,10 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander Header="{Binding Name}"
IsExpanded="False"
Style="{StaticResource ExpanderStyle}">
<Expander
Header="{Binding Name}"
IsExpanded="False"
Style="{StaticResource ExpanderStyle}">
<ItemsPresenter />
</Expander>
</ControlTemplate>
@@ -90,27 +97,28 @@
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<!-- BasedOn="{StaticResource MaterialWindowStyle}" -->
<Style x:Key="SZMEDIWindowStyle"
BasedOn="{StaticResource MaterialWindowStyle}"
TargetType="{x:Type controls:MaterialWindow}">
<Setter Property="FontFamily" Value="{StaticResource SourceHanSansSC}" />
<!-- BasedOn="{StaticResource MaterialWindowStyle}" -->
<Style
x:Key="SZMEDIWindowStyle"
BasedOn="{StaticResource MaterialWindowStyle}"
TargetType="{x:Type controls:MaterialWindow}">
<!--<Setter Property="FontFamily" Value="{StaticResource SourceHanSansSC}" />-->
<Setter Property="FontSize" Value="14" />
<Setter Property="Icon" Value="{StaticResource Logo}" />
</Style>
<Style BasedOn="{StaticResource MaterialDesignRaisedDarkButton}" TargetType="{x:Type Button}">
<Setter Property="BorderThickness" Value="0"/>
<!-- <Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="{StaticResource SZMCBrush}" /> -->
<Setter Property="BorderThickness" Value="0" />
<!-- <Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="{StaticResource SZMCBrush}" />-->
</Style>
<Style BasedOn="{StaticResource MaterialDesignCardGroupBox}" TargetType="{x:Type GroupBox}">
<!--<Setter Property="TextElement.Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />-->
<!--<Setter Property="Background" Value="{StaticResource SZMCBrush}" />-->
<!--<Setter Property="Background" Value="{StaticResource SZMCBrush}" />-->
</Style>
<Style TargetType="DataGridCell">
<Setter Property="MinHeight" Value="40" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<!--确保 TextBlock 也垂直居中(如果列内容是 TextBlock-->
<!-- 确保 TextBlock 也垂直居中(如果列内容是 TextBlock -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
@@ -127,9 +135,9 @@
<Setter Property="GridLinesVisibility" Value="Horizontal" />
</Style>
<Style BasedOn="{StaticResource MaterialDesignOutlinedComboBox}" TargetType="ComboBox">
<Setter Property="Padding" Value="8"/>
<Setter Property="Padding" Value="8" />
</Style>
<Style BasedOn="{StaticResource MaterialDesignOutlinedTextBox}" TargetType="TextBox">
<Setter Property="Padding" Value="8"/>
<Setter Property="Padding" Value="8" />
</Style>
</ResourceDictionary>