修复错误
This commit is contained in:
6
.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.agent.xml
generated
Normal file
6
.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.agent.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AgentMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.edit.xml
generated
Normal file
6
.idea/.idea.ShrlAlgoToolkit/.idea/copilot.data.migration.edit.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EditMigrationStateService">
|
||||
<option name="migrationStatus" value="COMPLETED" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -30,35 +30,4 @@ public class WindowAssist
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TitleBarBackgroundProperty =
|
||||
DependencyProperty.RegisterAttached("TitleBarBackground", typeof(Brush), typeof(WindowAssist));
|
||||
|
||||
/// <summary>
|
||||
/// 附加属性,用于手动控制控件的视觉状态。
|
||||
/// XAML中的Triggers将绑定到此属性,而不是IsMouseOver或IsPressed。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty WindowButtonStateProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"WindowButtonState", // 属性名
|
||||
typeof(WindowButtonState), // 属性类型 (我们定义的枚举)
|
||||
typeof(WindowAssist), // 拥有者类
|
||||
new PropertyMetadata(WindowButtonState.Normal)); // 默认值
|
||||
|
||||
public static WindowButtonState GetWindowButtonState(DependencyObject obj)
|
||||
{
|
||||
return (WindowButtonState)obj.GetValue(WindowButtonStateProperty);
|
||||
}
|
||||
|
||||
public static void SetWindowButtonState(DependencyObject obj, WindowButtonState value)
|
||||
{
|
||||
obj.SetValue(WindowButtonStateProperty, value);
|
||||
}
|
||||
|
||||
}
|
||||
/// 定义自定义窗口按钮的视觉状态。
|
||||
/// </summary>
|
||||
public enum WindowButtonState
|
||||
{
|
||||
Normal,
|
||||
MouseOver,
|
||||
Pressed,
|
||||
Disabled
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace NeoUI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 一个使用AdornerLayer实现、可作为原生Popup直接替代品的控件。
|
||||
/// 它能被窗口和ScrollViewer正确裁剪。
|
||||
/// </summary>
|
||||
public class AdornerPopup : ContentControl
|
||||
{
|
||||
private Adorner? _adorner;
|
||||
|
||||
// 【修正】将 _childCache 的类型从 UIElement? 更改为 FrameworkElement?
|
||||
private FrameworkElement? _childCache;
|
||||
|
||||
#region Dependency Properties (模仿原生Popup)
|
||||
|
||||
public static readonly DependencyProperty IsOpenProperty =
|
||||
DependencyProperty.Register("IsOpen", typeof(bool), typeof(AdornerPopup),
|
||||
new PropertyMetadata(false, OnIsOpenChanged));
|
||||
|
||||
public bool IsOpen
|
||||
{
|
||||
get => (bool)GetValue(IsOpenProperty);
|
||||
set => SetValue(IsOpenProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PlacementTargetProperty =
|
||||
DependencyProperty.Register("PlacementTarget", typeof(UIElement), typeof(AdornerPopup),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public UIElement PlacementTarget
|
||||
{
|
||||
get => (UIElement)GetValue(PlacementTargetProperty);
|
||||
set => SetValue(PlacementTargetProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is AdornerPopup popup)
|
||||
{
|
||||
popup.UpdateAdorner();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAdorner()
|
||||
{
|
||||
var target = PlacementTarget ?? this;
|
||||
var adornerLayer = AdornerLayer.GetAdornerLayer(target);
|
||||
if (adornerLayer == null) return;
|
||||
|
||||
if (IsOpen)
|
||||
{
|
||||
if (_adorner != null) return;
|
||||
|
||||
// 【修正】将 Content 转换为 FrameworkElement
|
||||
_childCache = Content as FrameworkElement;
|
||||
if (_childCache == null) return;
|
||||
|
||||
Content = null;
|
||||
|
||||
// 关键:将自身的DataContext传递给弹出的内容,以修复MVVM绑定
|
||||
// 因为 _childCache 现在是 FrameworkElement 类型,所以可以访问 DataContext
|
||||
_childCache.DataContext = DataContext;
|
||||
|
||||
_adorner = new ContentAdorner(target, _childCache);
|
||||
adornerLayer.Add(_adorner);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_adorner == null) return;
|
||||
|
||||
adornerLayer.Remove(_adorner);
|
||||
|
||||
if (_childCache != null)
|
||||
{
|
||||
// 清理 DataContext
|
||||
_childCache.DataContext = null;
|
||||
// 恢复内容
|
||||
Content = _childCache;
|
||||
_childCache = null;
|
||||
}
|
||||
|
||||
_adorner = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,7 @@
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="assists:ButtonAssist.AppearanceType" Value="{x:Static controls:AppearanceType.Primary}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="assists:ShadingAssist.LightShadowBrush" Value="{DynamicResource PrimaryLightShadowBrush}" />
|
||||
@@ -347,7 +347,7 @@
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="assists:ButtonAssist.AppearanceType" Value="{x:Static controls:AppearanceType.Info}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource InfoBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightShadowBrush" Value="{DynamicResource InfoLightShadowBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.DarkShadowBrush" Value="{DynamicResource InfoDarkShadowBrush}" />
|
||||
@@ -365,7 +365,7 @@
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="assists:ButtonAssist.AppearanceType" Value="{x:Static controls:AppearanceType.Error}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ErrorBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightShadowBrush" Value="{DynamicResource ErrorLightShadowBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.DarkShadowBrush" Value="{DynamicResource ErrorDarkShadowBrush}" />
|
||||
@@ -383,7 +383,7 @@
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="assists:ButtonAssist.AppearanceType" Value="{x:Static controls:AppearanceType.Warning}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource WarningBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightShadowBrush" Value="{DynamicResource WarningLightShadowBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.DarkShadowBrush" Value="{DynamicResource WarningDarkShadowBrush}" />
|
||||
@@ -401,7 +401,7 @@
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="assists:ButtonAssist.AppearanceType" Value="{x:Static controls:AppearanceType.Success}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SuccessBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.LightShadowBrush" Value="{DynamicResource SuccessLightShadowBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.DarkShadowBrush" Value="{DynamicResource SuccessDarkShadowBrush}" />
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasSelectedDays" Value="True">
|
||||
<Setter TargetName="SelectedBorder" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="NormalText" Property="TextElement.Foreground" Value="#e0e0e0" />
|
||||
<Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="SelectionMark" Property="Visibility" Value="Visible" />
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
|
||||
@@ -226,7 +226,6 @@
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
</Popup>
|
||||
<ToggleButton
|
||||
x:Name="toggleButton"
|
||||
@@ -404,6 +403,9 @@
|
||||
<Setter TargetName="opaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
|
||||
<Setter TargetName="opaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
<!-- 默认ComboBox样式 -->
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace NeoUI.Controls
|
||||
{
|
||||
public class ContentAdorner : Adorner
|
||||
{
|
||||
private readonly Grid _container;
|
||||
private readonly ContentPresenter _contentPresenter;
|
||||
private double _offsetY;
|
||||
|
||||
public ContentAdorner(UIElement adornedElement, UIElement content) : base(adornedElement)
|
||||
{
|
||||
_container = new Grid { Background = Brushes.Transparent };
|
||||
_contentPresenter = new ContentPresenter { Content = content };
|
||||
_container.Children.Add(_contentPresenter);
|
||||
AddLogicalChild(_container);
|
||||
AddVisualChild(_container);
|
||||
}
|
||||
|
||||
protected override int VisualChildrenCount => 1;
|
||||
protected override Visual GetVisualChild(int index) => _container;
|
||||
|
||||
public override GeneralTransform GetDesiredTransform(GeneralTransform transform)
|
||||
{
|
||||
var result = new GeneralTransformGroup();
|
||||
result.Children.Add(base.GetDesiredTransform(transform));
|
||||
result.Children.Add(new TranslateTransform(0, _offsetY));
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
_container.Measure(constraint);
|
||||
return _container.DesiredSize;
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size finalSize)
|
||||
{
|
||||
var finalRect = new Rect(new Point(0, 0), finalSize);
|
||||
if (_contentPresenter.Content is FrameworkElement contentElement)
|
||||
{
|
||||
_offsetY = AdornedElement.RenderSize.Height + contentElement.Margin.Top;
|
||||
}
|
||||
else
|
||||
{
|
||||
_offsetY = AdornedElement.RenderSize.Height;
|
||||
}
|
||||
_container.Arrange(finalRect);
|
||||
return finalSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="AllowDrop" Value="true" />
|
||||
<Setter Property="AllowDrop" Value="True" />
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||
<Setter Property="ContextMenu" Value="{DynamicResource TextBoxContextMenu}" />
|
||||
@@ -29,23 +29,23 @@
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="border">
|
||||
<ScrollViewer
|
||||
Focusable="false"
|
||||
Focusable="False"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Hidden"
|
||||
x:Name="PART_ContentHost" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- TODO:禁用效果 -->
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="TextElement.Foreground" TargetName="PART_ContentHost" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}"/>
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsKeyboardFocused" Value="true">
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
|
||||
</Trigger>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal">
|
||||
@@ -34,8 +35,8 @@
|
||||
Padding="-4"
|
||||
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
|
||||
Intensity="0.2"
|
||||
Visibility="Collapsed"
|
||||
ShaderEnabled="False"/>
|
||||
ShaderEnabled="False"
|
||||
Visibility="Collapsed" />
|
||||
<ContentPresenter
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
@@ -51,7 +52,7 @@
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
<!--多选时,隐藏指示器-->
|
||||
<!-- 多选时,隐藏指示器 -->
|
||||
<DataTrigger Binding="{Binding Path=SelectionMode, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" Value="Multiple">
|
||||
<Setter TargetName="slot" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
@@ -101,7 +102,7 @@
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
<!--隐藏滑块-->
|
||||
<!-- 隐藏滑块 -->
|
||||
<Trigger Property="SelectionMode" Value="Multiple">
|
||||
<Setter TargetName="PART_SlideCanvas" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
@@ -172,7 +173,7 @@
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -250,7 +251,8 @@
|
||||
<Condition Property="Selector.IsSelectionActive" Value="False" />
|
||||
<Condition Property="IsSelected" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</MultiTrigger>
|
||||
<!-- 选中对象有焦点 -->
|
||||
<MultiTrigger>
|
||||
@@ -259,7 +261,7 @@
|
||||
<Condition Property="IsSelected" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
@@ -269,9 +271,12 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
|
||||
<Style BasedOn="{StaticResource ListBoxItemContainerDefault}" TargetType="{x:Type ListBoxItem}" />
|
||||
|
||||
<Style x:Key="ListBoxDefault" TargetType="{x:Type ListBox}">
|
||||
<Style x:Key="DefaultListBox" TargetType="{x:Type ListBox}">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
@@ -297,7 +302,9 @@
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="true">
|
||||
<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
|
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
<WrapPanel>
|
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</WrapPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
@@ -317,5 +324,112 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource ListBoxDefault}" TargetType="{x:Type ListBox}" />
|
||||
<Style x:Key="ChipListBoxItem" TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Padding" Value="4,2" />
|
||||
<Setter Property="Margin" Value="1,2" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Grid>
|
||||
<decorations:EmbossBorder
|
||||
x:Name="emboss"
|
||||
Margin="0"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0.6"
|
||||
ShaderEnabled="True" />
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
Intensity="0.4"
|
||||
ShaderEnabled="False">
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</decorations:SlotBorder>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource PrimaryGradientBrush}" />
|
||||
<Setter Property="Visibility" TargetName="emboss" Value="Collapsed" />
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="emboss" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="slot" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ChipListBoxStyle" TargetType="{x:Type ListBox}">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ChipListBoxItem}" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBox}">
|
||||
<decorations:EmbossBorder
|
||||
x:Name="Bd"
|
||||
Padding="2"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="true">
|
||||
<ScrollViewer
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Focusable="false"
|
||||
HorizontalScrollBarVisibility="Disabled">
|
||||
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</ScrollViewer>
|
||||
</decorations:EmbossBorder>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsGrouping" Value="true" />
|
||||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultListBox}" TargetType="{x:Type ListBox}" />
|
||||
</ResourceDictionary>
|
||||
@@ -246,7 +246,7 @@
|
||||
<Condition Property="IsSelected" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
|
||||
@@ -154,13 +154,14 @@
|
||||
<controls:IconElement
|
||||
x:Name="GlyphPanel"
|
||||
Grid.Column="0"
|
||||
Margin="6,3,0,3"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Symbol="Check"
|
||||
Foreground="{DynamicResource PrimaryGradientBrush}"
|
||||
FlowDirection="LeftToRight"
|
||||
Visibility="Collapsed" />
|
||||
<ContentPresenter
|
||||
VerticalAlignment="Center"
|
||||
Grid.Column="1"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
ContentSource="Header"
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<!--<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />-->
|
||||
<!--<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />-->
|
||||
<!--<Setter Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />-->
|
||||
</DataTrigger>
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="HeadBackground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter Property="HeadForeground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="HeadForeground" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Padding" Value="5,3" />
|
||||
|
||||
@@ -105,8 +105,8 @@
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<!--<Setter Property="assists:ButtonAssist.Icon" Value="{markup:Icon SymbolValue=ArrowDropUp}" />-->
|
||||
<Setter Property="Focusable" Value="false" />
|
||||
<Setter Property="IsTabStop" Value="false" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type RepeatButton}">
|
||||
@@ -143,7 +143,7 @@
|
||||
<!-- 垂直滑块 -->
|
||||
<Style x:Key="ScrollBarThumbVertical" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true" />
|
||||
<Setter Property="IsTabStop" Value="false" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
@@ -177,7 +177,7 @@
|
||||
<!-- 水平滑块 -->
|
||||
<Style x:Key="ScrollBarThumbHorizontal" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="true" />
|
||||
<Setter Property="IsTabStop" Value="false" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
@@ -265,7 +265,7 @@
|
||||
<BeginStoryboard Storyboard="{StaticResource HideScrollItem}" />
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="PART_LineUpButton" Property="Visibility" Value="Hidden" />
|
||||
<Setter TargetName="PART_LineDownButton" Property="Visibility" Value="Hidden" />
|
||||
</Trigger>
|
||||
@@ -328,7 +328,7 @@
|
||||
<BeginStoryboard Storyboard="{StaticResource HideScrollItem}" />
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="PART_LineLeftButton" Property="Visibility" Value="Hidden" />
|
||||
<Setter TargetName="PART_LineRightButton" Property="Visibility" Value="Hidden" />
|
||||
</Trigger>
|
||||
@@ -337,8 +337,8 @@
|
||||
|
||||
<!-- 滚动条样式 -->
|
||||
<Style TargetType="{x:Type ScrollBar}">
|
||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="false" />
|
||||
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1,0" />
|
||||
<Setter Property="Width" Value="10" />
|
||||
@@ -407,7 +407,7 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<!-- 使用父对象的边框色 -->
|
||||
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}}, Path=BorderBrush, Mode=OneWay, FallbackValue={StaticResource BorderNormalBrush}}" />
|
||||
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}}, Path=BorderBrush, Mode=OneWay}" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="8,4" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonDefaultStyle">
|
||||
<Style TargetType="{x:Type ToggleButton}" x:Key="DefaultToggleButtonStyle">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||||
<!--<Setter Property="BorderBrush" Value="{DynamicResource BackgroundLayoutBrush}" />-->
|
||||
@@ -213,7 +213,7 @@
|
||||
Intensity="0.6"
|
||||
Margin="0"
|
||||
ShaderEnabled="True"
|
||||
x:Name="border" />
|
||||
x:Name="emboss" />
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
Intensity="0"
|
||||
@@ -241,7 +241,7 @@
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource PrimaryGradientBrush}" />
|
||||
<Setter Property="Visibility" TargetName="border" Value="Collapsed" />
|
||||
<Setter Property="Visibility" TargetName="emboss" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
@@ -252,9 +252,8 @@
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" TargetName="border" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="ShaderEnabled" TargetName="border" Value="False" />
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="False" />
|
||||
<Setter Property="Background" TargetName="emboss" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="Background" TargetName="slot" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
|
||||
@@ -455,8 +454,6 @@
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
</Border>
|
||||
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Background" TargetName="border" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
@@ -478,5 +475,5 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource ToggleButtonDefaultStyle}" TargetType="ToggleButton" />
|
||||
<Style BasedOn="{StaticResource DefaultToggleButtonStyle}" TargetType="ToggleButton" />
|
||||
</ResourceDictionary>
|
||||
@@ -178,8 +178,8 @@
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
<!--<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />-->
|
||||
<Setter TargetName="Expander" Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<!--<Setter Property="Foreground" Value="{DynamicResource TextAccentBrush}" />-->
|
||||
<Setter TargetName="Expander" Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="UIElement.IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||||
@@ -190,7 +190,7 @@
|
||||
<Condition Property="IsSelectionActive" Value="False" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
<Setter TargetName="Expander" Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter TargetName="Expander" Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
@@ -198,7 +198,7 @@
|
||||
<Condition Property="UIElement.IsMouseOver" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundPressedBrush}" />
|
||||
<Setter TargetName="Expander" Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter TargetName="Expander" Property="Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</MultiTrigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
<Style x:Key="WindowButton" TargetType="{x:Type Button}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="UseLayoutRounding" Value="True"/>
|
||||
<Setter Property="UseLayoutRounding" Value="True" />
|
||||
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<!--<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>-->
|
||||
<!--<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />-->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
@@ -40,8 +40,8 @@
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<!--<Condition Property="IsMouseOver" Value="True" />-->
|
||||
<Condition Property="assists:WindowAssist.WindowButtonState" Value="MouseOver" />
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
<!--<Condition Property="assists:WindowAssist.WindowButtonState" Value="MouseOver" />-->
|
||||
<Condition Property="Background" Value="Transparent" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="border" Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||||
@@ -52,8 +52,8 @@
|
||||
</Setter>
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</MultiTrigger>
|
||||
<!--<Trigger Property="IsPressed" Value="True">-->
|
||||
<Trigger Property="assists:WindowAssist.WindowButtonState" Value="Pressed">
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<!--<Trigger Property="assists:WindowAssist.WindowButtonState" Value="Pressed">-->
|
||||
<Setter TargetName="border" Property="Effect">
|
||||
<Setter.Value>
|
||||
<effects:BrightnessContrastEffect Brightness="0.05" />
|
||||
@@ -122,8 +122,8 @@
|
||||
<Setter Property="WindowChrome.WindowChrome">
|
||||
<Setter.Value>
|
||||
<WindowChrome UseAeroCaptionButtons="False">
|
||||
<!-- <WindowChrome.ResizeBorderThickness>6</WindowChrome.ResizeBorderThickness> -->
|
||||
<!-- <WindowChrome.NonClientFrameEdges>Left,Bottom,Right</WindowChrome.NonClientFrameEdges> -->
|
||||
<!--<WindowChrome.ResizeBorderThickness>6</WindowChrome.ResizeBorderThickness>
|
||||
<WindowChrome.NonClientFrameEdges>Left,Bottom,Right</WindowChrome.NonClientFrameEdges>-->
|
||||
</WindowChrome>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@@ -180,7 +180,6 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- 自定义标题栏 -->
|
||||
<!-- 上方背景 -->
|
||||
<!--<Border Background="{Binding Path=(assists:WindowAssist.TitleBarBackground), RelativeSource={RelativeSource TemplatedParent}}" />-->
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
@@ -257,7 +256,7 @@
|
||||
Content="{TemplateBinding TitleBarRightContent}"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
<!-- 功能按钮 -->
|
||||
<Button x:Name="minimizeButton">
|
||||
<Button x:Name="minimizeButton" ToolTip="最小化" >
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
@@ -276,7 +275,7 @@
|
||||
Symbol="Minimize"
|
||||
UseLayoutRounding="True" />
|
||||
</Button>
|
||||
<Button x:Name="maximizeRestoreButton">
|
||||
<Button x:Name="maximizeRestoreButton" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
@@ -313,12 +312,12 @@
|
||||
</Button.Style>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="closeButton">
|
||||
<Button x:Name="closeButton" ToolTip="关闭" WindowChrome.IsHitTestVisibleInChrome="True">
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<!--<Trigger Property="IsMouseOver" Value="True">-->
|
||||
<Trigger Property="assists:WindowAssist.WindowButtonState" Value="MouseOver">
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<!--<Trigger Property="assists:WindowAssist.WindowButtonState" Value="MouseOver">-->
|
||||
<Setter Property="Background" Value="{DynamicResource ErrorBrush}" />
|
||||
<Setter Property="Foreground" Value="#e0e0e0" />
|
||||
</Trigger>
|
||||
|
||||
@@ -25,155 +25,155 @@ public class NeoWindow : Window
|
||||
public NeoWindow()
|
||||
{
|
||||
SetResourceReference(StyleProperty, typeof(NeoWindow)); //设置默认的样式资源引用
|
||||
this.Deactivated += OnWindowDeactivated;
|
||||
this.MouseLeave += OnWindowMouseLeave;
|
||||
//this.Deactivated += OnWindowDeactivated;
|
||||
//this.MouseLeave += OnWindowMouseLeave;
|
||||
}
|
||||
#region 自定义标题栏按钮行为
|
||||
private Button? hoveredButton;
|
||||
private Button? pressedButton;
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
var source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||
source?.AddHook(HwndSourceHook);
|
||||
}
|
||||
//private Button? hoveredButton;
|
||||
//private Button? pressedButton;
|
||||
//protected override void OnSourceInitialized(EventArgs e)
|
||||
//{
|
||||
// base.OnSourceInitialized(e);
|
||||
// var source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
|
||||
// source?.AddHook(HwndSourceHook);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 处理窗口消息,用于命中测试和与自定义窗口按钮的鼠标交互。
|
||||
/// </summary>
|
||||
/// <remarks>此方法处理特定的窗口消息,包括命中测试和鼠标按钮交互,
|
||||
/// 以支持自定义窗口按钮行为。它会更新按钮状态(例如悬停、按下)并
|
||||
/// 适当地引发自定义按钮的点击事件。</remarks>
|
||||
/// <param name="hwnd">接收消息的窗口句柄。</param>
|
||||
/// <param name="msg">消息标识符,例如命中测试或鼠标按钮事件。</param>
|
||||
/// <param name="wParam">附加的特定于消息的信息。</param>
|
||||
/// <param name="lParam">附加的特定于消息的信息,通常包含鼠标坐标。</param>
|
||||
/// <param name="handled">指示消息是否已被处理的值。如果消息已被处理,则设置为 <see langword="true"/>;
|
||||
/// 否则为 <see langword="false"/>。</param>
|
||||
/// <returns>表示消息处理结果的 <see cref="IntPtr"/>。对于命中测试消息返回命中测试结果,
|
||||
/// 对于未处理的消息返回 <see cref="IntPtr.Zero"/>。</returns>
|
||||
private IntPtr HwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
const int WM_NCHITTEST = 0x0084;
|
||||
const int WM_NCLBUTTONDOWN = 0x00A1;
|
||||
const int WM_NCLBUTTONUP = 0x00A2;
|
||||
///// <summary>
|
||||
///// 处理窗口消息,用于命中测试和与自定义窗口按钮的鼠标交互。
|
||||
///// </summary>
|
||||
///// <remarks>此方法处理特定的窗口消息,包括命中测试和鼠标按钮交互,
|
||||
///// 以支持自定义窗口按钮行为。它会更新按钮状态(例如悬停、按下)并
|
||||
///// 适当地引发自定义按钮的点击事件。</remarks>
|
||||
///// <param name="hwnd">接收消息的窗口句柄。</param>
|
||||
///// <param name="msg">消息标识符,例如命中测试或鼠标按钮事件。</param>
|
||||
///// <param name="wParam">附加的特定于消息的信息。</param>
|
||||
///// <param name="lParam">附加的特定于消息的信息,通常包含鼠标坐标。</param>
|
||||
///// <param name="handled">指示消息是否已被处理的值。如果消息已被处理,则设置为 <see langword="true"/>;
|
||||
///// 否则为 <see langword="false"/>。</param>
|
||||
///// <returns>表示消息处理结果的 <see cref="IntPtr"/>。对于命中测试消息返回命中测试结果,
|
||||
///// 对于未处理的消息返回 <see cref="IntPtr.Zero"/>。</returns>
|
||||
//private IntPtr HwndSourceHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
//{
|
||||
// const int WM_NCHITTEST = 0x0084;
|
||||
// const int WM_NCLBUTTONDOWN = 0x00A1;
|
||||
// const int WM_NCLBUTTONUP = 0x00A2;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_NCHITTEST:
|
||||
// 1. 进行命中测试,并获取鼠标下的按钮
|
||||
HitTestResult hitTestResult = HitTestButton(PointFromScreen(new Point((short)(lParam.ToInt32() & 0xFFFF), (short)(lParam.ToInt32() >> 16))));
|
||||
// switch (msg)
|
||||
// {
|
||||
// case WM_NCHITTEST:
|
||||
// // 1. 进行命中测试,并获取鼠标下的按钮
|
||||
// HitTestResult hitTestResult = HitTestButton(PointFromScreen(new Point((short)(lParam.ToInt32() & 0xFFFF), (short)(lParam.ToInt32() >> 16))));
|
||||
|
||||
// 2. 更新悬停状态(内部会设置附加属性)
|
||||
UpdateHoverState(hitTestResult.Button);
|
||||
// // 2. 更新悬停状态(内部会设置附加属性)
|
||||
// UpdateHoverState(hitTestResult.Button);
|
||||
|
||||
if (hitTestResult.Result != IntPtr.Zero)
|
||||
{
|
||||
handled = true;
|
||||
return hitTestResult.Result;
|
||||
}
|
||||
break;
|
||||
// if (hitTestResult.Result != IntPtr.Zero)
|
||||
// {
|
||||
// handled = true;
|
||||
// return hitTestResult.Result;
|
||||
// }
|
||||
// break;
|
||||
|
||||
case WM_NCLBUTTONDOWN:
|
||||
if (hoveredButton != null)
|
||||
{
|
||||
pressedButton = hoveredButton;
|
||||
// 3. 设置状态为 Pressed
|
||||
WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Pressed);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
// case WM_NCLBUTTONDOWN:
|
||||
// if (hoveredButton != null)
|
||||
// {
|
||||
// pressedButton = hoveredButton;
|
||||
// // 3. 设置状态为 Pressed
|
||||
// WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Pressed);
|
||||
// handled = true;
|
||||
// }
|
||||
// break;
|
||||
|
||||
case WM_NCLBUTTONUP:
|
||||
if (pressedButton != null)
|
||||
{
|
||||
// 4. 触发按钮的Click事件
|
||||
if (pressedButton.IsEnabled)
|
||||
{
|
||||
pressedButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
}
|
||||
// case WM_NCLBUTTONUP:
|
||||
// if (pressedButton != null)
|
||||
// {
|
||||
// // 4. 触发按钮的Click事件
|
||||
// if (pressedButton.IsEnabled)
|
||||
// {
|
||||
// pressedButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
|
||||
// }
|
||||
|
||||
// 5. 重置状态
|
||||
Button previouslyPressedButton = pressedButton;
|
||||
pressedButton = null;
|
||||
// 检查鼠标是否仍在按钮上,以决定恢复到Hover还是Normal状态
|
||||
UpdateHoverState(hoveredButton == previouslyPressedButton ? previouslyPressedButton : null);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
// // 5. 重置状态
|
||||
// Button previouslyPressedButton = pressedButton;
|
||||
// pressedButton = null;
|
||||
// // 检查鼠标是否仍在按钮上,以决定恢复到Hover还是Normal状态
|
||||
// UpdateHoverState(hoveredButton == previouslyPressedButton ? previouslyPressedButton : null);
|
||||
// handled = true;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// return IntPtr.Zero;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 更新悬停状态。
|
||||
/// </summary>
|
||||
/// <param name="currentHoveredButton"></param>
|
||||
private void UpdateHoverState(Button? currentHoveredButton)
|
||||
{
|
||||
if (currentHoveredButton != hoveredButton)
|
||||
{
|
||||
// 离开旧按钮:如果之前有悬停的按钮,并且它当前不是"按下"状态,则恢复为"Normal"
|
||||
if (hoveredButton != null && hoveredButton != pressedButton)
|
||||
{
|
||||
WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.Normal);
|
||||
}
|
||||
///// <summary>
|
||||
///// 更新悬停状态。
|
||||
///// </summary>
|
||||
///// <param name="currentHoveredButton"></param>
|
||||
//private void UpdateHoverState(Button? currentHoveredButton)
|
||||
//{
|
||||
// if (currentHoveredButton != hoveredButton)
|
||||
// {
|
||||
// // 离开旧按钮:如果之前有悬停的按钮,并且它当前不是"按下"状态,则恢复为"Normal"
|
||||
// if (hoveredButton != null && hoveredButton != pressedButton)
|
||||
// {
|
||||
// WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.Normal);
|
||||
// }
|
||||
|
||||
hoveredButton = currentHoveredButton;
|
||||
// hoveredButton = currentHoveredButton;
|
||||
|
||||
// 进入新按钮:如果现在有一个新的悬停按钮,并且它当前不是"按下"状态,则切换为"MouseOver"
|
||||
if (hoveredButton != null && hoveredButton != pressedButton)
|
||||
{
|
||||
WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.MouseOver);
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 进入新按钮:如果现在有一个新的悬停按钮,并且它当前不是"按下"状态,则切换为"MouseOver"
|
||||
// if (hoveredButton != null && hoveredButton != pressedButton)
|
||||
// {
|
||||
// WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.MouseOver);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 窗体失去焦点时,重置所有按钮状态。
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnWindowDeactivated(object? sender, EventArgs e) => ResetButtonStates();
|
||||
/// <summary>
|
||||
/// 鼠标离开窗口时,重置所有按钮状态。
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnWindowMouseLeave(object sender, MouseEventArgs e) => ResetButtonStates();
|
||||
/// <summary>
|
||||
/// 重置所有按钮的状态为 Normal。
|
||||
/// </summary>
|
||||
private void ResetButtonStates()
|
||||
{
|
||||
if (pressedButton != null)
|
||||
{
|
||||
WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Normal);
|
||||
pressedButton = null;
|
||||
}
|
||||
UpdateHoverState(null);
|
||||
}
|
||||
///// <summary>
|
||||
///// 窗体失去焦点时,重置所有按钮状态。
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//private void OnWindowDeactivated(object? sender, EventArgs e) => ResetButtonStates();
|
||||
///// <summary>
|
||||
///// 鼠标离开窗口时,重置所有按钮状态。
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//private void OnWindowMouseLeave(object sender, MouseEventArgs e) => ResetButtonStates();
|
||||
///// <summary>
|
||||
///// 重置所有按钮的状态为 Normal。
|
||||
///// </summary>
|
||||
//private void ResetButtonStates()
|
||||
//{
|
||||
// if (pressedButton != null)
|
||||
// {
|
||||
// WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Normal);
|
||||
// pressedButton = null;
|
||||
// }
|
||||
// UpdateHoverState(null);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 对窗口的标题栏按钮进行命中测试,确定鼠标位置是否在按钮上。
|
||||
/// </summary>
|
||||
/// <param name="windowPos"></param>
|
||||
/// <returns></returns>
|
||||
private HitTestResult HitTestButton(Point windowPos)
|
||||
{
|
||||
const int HTMINBUTTON = 8;
|
||||
const int HTMAXBUTTON = 9;
|
||||
const int HTCLOSE = 20;
|
||||
///// <summary>
|
||||
///// 对窗口的标题栏按钮进行命中测试,确定鼠标位置是否在按钮上。
|
||||
///// </summary>
|
||||
///// <param name="windowPos"></param>
|
||||
///// <returns></returns>
|
||||
//private HitTestResult HitTestButton(Point windowPos)
|
||||
//{
|
||||
// const int HTMINBUTTON = 8;
|
||||
// const int HTMAXBUTTON = 9;
|
||||
// const int HTCLOSE = 20;
|
||||
|
||||
if (closeButton != null && GetElementRect(closeButton).Contains(windowPos))
|
||||
return new HitTestResult(new IntPtr(HTCLOSE), closeButton);
|
||||
if (maximizeRestoreButton != null && GetElementRect(maximizeRestoreButton).Contains(windowPos))
|
||||
return new HitTestResult(new IntPtr(HTMAXBUTTON), maximizeRestoreButton);
|
||||
if (minimizeButton != null && GetElementRect(minimizeButton).Contains(windowPos))
|
||||
return new HitTestResult(new IntPtr(HTMINBUTTON), minimizeButton);
|
||||
// if (closeButton != null && GetElementRect(closeButton).Contains(windowPos))
|
||||
// return new HitTestResult(new IntPtr(HTCLOSE), closeButton);
|
||||
// if (maximizeRestoreButton != null && GetElementRect(maximizeRestoreButton).Contains(windowPos))
|
||||
// return new HitTestResult(new IntPtr(HTMAXBUTTON), maximizeRestoreButton);
|
||||
// if (minimizeButton != null && GetElementRect(minimizeButton).Contains(windowPos))
|
||||
// return new HitTestResult(new IntPtr(HTMINBUTTON), minimizeButton);
|
||||
|
||||
return new HitTestResult(IntPtr.Zero, null);
|
||||
}
|
||||
// return new HitTestResult(IntPtr.Zero, null);
|
||||
//}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -193,13 +193,13 @@
|
||||
<Color x:Key="TextPrimaryColor">#e0e6ed</Color>
|
||||
<Color x:Key="TextSecondaryColor">#6d7a7d</Color>
|
||||
<Color x:Key="TextDisabledColor">#767676</Color>
|
||||
<Color x:Key="TextInverseColor">#1C1E22</Color>
|
||||
<Color x:Key="TextAccentColor">#f7ffff</Color>
|
||||
<Color x:Key="TextPlaceholderColor">#7B7E85</Color>
|
||||
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="{DynamicResource TextPrimaryColor}" />
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="{DynamicResource TextSecondaryColor}" />
|
||||
<SolidColorBrush x:Key="TextDisabledBrush" Color="{DynamicResource TextDisabledColor}" />
|
||||
<SolidColorBrush x:Key="TextInverseBrush" Color="{DynamicResource TextInverseColor}" />
|
||||
<SolidColorBrush x:Key="TextAccentBrush" Color="{DynamicResource TextAccentColor}" />
|
||||
<SolidColorBrush x:Key="TextPlaceholderBrush" Color="{DynamicResource TextPlaceholderColor}" />
|
||||
|
||||
|
||||
|
||||
@@ -192,13 +192,13 @@
|
||||
<Color x:Key="TextPrimaryColor">#5c7191</Color>
|
||||
<Color x:Key="TextSecondaryColor">#7386a2</Color>
|
||||
<Color x:Key="TextDisabledColor">#aeb3bb</Color>
|
||||
<Color x:Key="TextInverseColor">#f7ffff</Color>
|
||||
<Color x:Key="TextAccentColor">#f7ffff</Color>
|
||||
<Color x:Key="TextPlaceholderColor">#aaaeb3</Color>
|
||||
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="{DynamicResource TextPrimaryColor}" />
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="{DynamicResource TextSecondaryColor}" />
|
||||
<SolidColorBrush x:Key="TextDisabledBrush" Color="{DynamicResource TextDisabledColor}" />
|
||||
<SolidColorBrush x:Key="TextInverseBrush" Color="{DynamicResource TextInverseColor}" />
|
||||
<SolidColorBrush x:Key="TextAccentBrush" Color="{DynamicResource TextAccentColor}" />
|
||||
<SolidColorBrush x:Key="TextPlaceholderBrush" Color="{DynamicResource TextPlaceholderColor}" />
|
||||
|
||||
|
||||
|
||||
@@ -233,20 +233,23 @@
|
||||
<StackPanel n:AnchorAssist.Header="通知 Toast">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Click="LeftTopButton_Click" Content="Notification左上" />
|
||||
<Button Click="RightTopButton_Click" Content="Notification右上" />
|
||||
<Button Click="LeftBottomButton_Click" Content="Notification左下" />
|
||||
<Button Click="RightBottomButton_Click" Content="Notification右下" />
|
||||
<TextBlock Text="Notification:" VerticalAlignment="Center" Margin="5"/>
|
||||
<Button Click="LeftTopButton_Click" Content="左上" />
|
||||
<Button Click="RightTopButton_Click" Content="右上" />
|
||||
<Button Click="LeftBottomButton_Click" Content="左下" />
|
||||
<Button Click="RightBottomButton_Click" Content="右下" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Click="Info_Click" Content="ToastInfo" />
|
||||
<Button Click="Success_Click" Content="ToastSuccess" />
|
||||
<Button Click="Warning_Click" Content="ToastWarning" />
|
||||
<Button Click="Error_Click" Content="ToastError" />
|
||||
<TextBlock Text="Toast:" VerticalAlignment="Center" Margin="5"/>
|
||||
<Button Click="Info_Click" Content="Info" />
|
||||
<Button Click="Success_Click" Content="Success" />
|
||||
<Button Click="Warning_Click" Content="Warning" />
|
||||
<Button Click="Error_Click" Content="Error" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Click="ShowBasicModal_Click" Content="BasicModal" />
|
||||
<Button Click="ShowAsyncModal_Click" Content="AsyncModal" />
|
||||
<TextBlock Text="Modal:" VerticalAlignment="Center" Margin="5"/>
|
||||
<Button Click="ShowBasicModal_Click" Content="基础模态框" />
|
||||
<Button Click="ShowAsyncModal_Click" Content="异步模态框" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -552,16 +555,20 @@
|
||||
Step="0.05"
|
||||
Value="10" />
|
||||
<n:NumericBox CurValue="100" Style="{StaticResource DefaultTextBox}" />
|
||||
|
||||
</n:FlexibleRowPanel>
|
||||
<RichTextBox Grid.Row="2">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Bold>Flow Document</Bold>
|
||||
in a<Run Foreground="{StaticResource PrimaryGradientBrush}">富文本框.</Run>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
<n:FlexibleRowPanel>
|
||||
<TextBox Style="{StaticResource NeuTextBox}" Margin="4"/>
|
||||
<TextBox Style="{StaticResource NeuTextBox}" IsEnabled="False" Margin="4"/>
|
||||
<RichTextBox Grid.Row="2">
|
||||
<FlowDocument>
|
||||
<Paragraph>
|
||||
<Bold>Flow Document</Bold>
|
||||
in a
|
||||
<Run Foreground="{StaticResource PrimaryGradientBrush}">富文本框.</Run>
|
||||
</Paragraph>
|
||||
</FlowDocument>
|
||||
</RichTextBox>
|
||||
</n:FlexibleRowPanel>
|
||||
</StackPanel>
|
||||
<StackPanel n:AnchorAssist.Header="文件、文件夹 Browser">
|
||||
<n:FlexibleRowPanel>
|
||||
@@ -1021,7 +1028,7 @@
|
||||
|
||||
<StackPanel n:AnchorAssist.Header="列表框 ListBox">
|
||||
<n:FlexibleRowPanel>
|
||||
<ListBox Margin="4">
|
||||
<ListBox Margin="4" >
|
||||
<ListBoxItem>SyminOmega</ListBoxItem>
|
||||
<ListBoxItem>Celeron533</ListBoxItem>
|
||||
<ListBoxItem>Hello World</ListBoxItem>
|
||||
@@ -1029,6 +1036,14 @@
|
||||
<ListBoxItem>Item Demo</ListBoxItem>
|
||||
<ListBoxItem>Item Demo</ListBoxItem>
|
||||
</ListBox>
|
||||
<ListBox SelectionMode="Multiple" Margin="4" Style="{StaticResource ChipListBoxStyle}">
|
||||
<ListBoxItem IsSelected="True">SyminOmega</ListBoxItem>
|
||||
<ListBoxItem>Celeron533</ListBoxItem>
|
||||
<ListBoxItem>Hello World</ListBoxItem>
|
||||
<ListBoxItem>Furry Fantasy</ListBoxItem>
|
||||
<ListBoxItem>Item Demo</ListBoxItem>
|
||||
<ListBoxItem>Item Demo</ListBoxItem>
|
||||
</ListBox>
|
||||
|
||||
<ListView
|
||||
Margin="4"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
Width="800"
|
||||
Height="450"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{DynamicResource AppBackgroundBrush}">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
|
||||
@@ -30,5 +30,19 @@ namespace Sample
|
||||
await HybridThemeManager.SwitchThemeAsync();
|
||||
SwitchThemeButton.IsEnabled = true;
|
||||
}
|
||||
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void MaximizeRestoreButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = (this.WindowState == WindowState.Maximized) ? WindowState.Normal : WindowState.Maximized;
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
using Color = System.Windows.Media.Color;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
@@ -9,23 +10,24 @@ namespace ShrlAlgoToolkit.RevitAddins.Converters;
|
||||
/// </summary>
|
||||
public class Rv2WinColorConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var color = (Autodesk.Revit.DB.Color)value;
|
||||
//if (Autodesk.Revit.DB.SelectedColor.InvalidColorValue)
|
||||
//{
|
||||
//}
|
||||
if (color is { IsValid: true })
|
||||
{
|
||||
var rgb = Color.FromRgb(color.Red, color.Green, color.Blue);
|
||||
return rgb;
|
||||
}
|
||||
public static Rv2WinColorConverter Instance { get; } = new Rv2WinColorConverter();
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var color = (Autodesk.Revit.DB.Color)value;
|
||||
//if (Autodesk.Revit.DB.SelectedColor.InvalidColorValue)
|
||||
//{
|
||||
//}
|
||||
if (color is { IsValid: true })
|
||||
{
|
||||
var rgb = Color.FromRgb(color.Red, color.Green, color.Blue);
|
||||
return rgb;
|
||||
}
|
||||
|
||||
return new Color();
|
||||
}
|
||||
return new Color();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value is Color rgb ? new Autodesk.Revit.DB.Color(rgb.R, rgb.G, rgb.B) : (object)Autodesk.Revit.DB.Color.InvalidColorValue;
|
||||
}
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value is Color rgb ? new Autodesk.Revit.DB.Color(rgb.R, rgb.G, rgb.B) : (object)Autodesk.Revit.DB.Color.InvalidColorValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace ShrlAlgoToolkit.RevitAddins.Converters
|
||||
{
|
||||
public class SearchTypeValueConverter : IMultiValueConverter
|
||||
{
|
||||
public static SearchTypeValueConverter Instance { get; } = new SearchTypeValueConverter();
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
@@ -23,6 +24,7 @@ namespace ShrlAlgoToolkit.RevitAddins.Converters
|
||||
}
|
||||
public class SearchFamilyValueConverter : IMultiValueConverter
|
||||
{
|
||||
public static SearchFamilyValueConverter Instance { get; } = new SearchFamilyValueConverter();
|
||||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
var cellText = values[0] == null ? string.Empty : values[0].ToString();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ui:NeoWindow
|
||||
Height="300"
|
||||
Height="200"
|
||||
SizeToContent="Height"
|
||||
Title="拆分模型"
|
||||
Topmost="True"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
MinHeight="500"
|
||||
MinWidth="275"
|
||||
Title="房间饰面"
|
||||
Background="Black"
|
||||
Width="200"
|
||||
d:DataContext="{d:DesignInstance Type=rvCivil:FloorFinishesViewModel}"
|
||||
mc:Ignorable="d"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Windows;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.IFC;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.Assists;
|
||||
@@ -12,290 +14,295 @@ namespace ShrlAlgoToolkit.RevitAddins.RvCivil;
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
public class SplitComsByLevelCmd : ExternalCommand
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
var instances = Document.OfCollector().OfClass(typeof(FamilyInstance)).Cast<FamilyInstance>().ToList();
|
||||
var errors = new List<MessageModel>();
|
||||
using (TransactionGroup tg = new(Document, "按标高拆分墙、柱"))
|
||||
{
|
||||
tg.Start();
|
||||
//墙打断
|
||||
using (Transaction trans = new(Document, "楼层分割打断构件"))
|
||||
{
|
||||
trans.Start();
|
||||
public override void Execute()
|
||||
{
|
||||
var result = MessageBox.Show("可能一定时间,请耐心等待,是否继续?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||
if (result != MessageBoxResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var instances = Document.OfCollector().OfClass(typeof(FamilyInstance)).Cast<FamilyInstance>().ToList();
|
||||
var errors = new List<MessageModel>();
|
||||
using (TransactionGroup tg = new(Document, "按标高拆分墙、柱"))
|
||||
{
|
||||
tg.Start();
|
||||
//墙打断
|
||||
using (Transaction trans = new(Document, "楼层分割打断构件"))
|
||||
{
|
||||
trans.Start();
|
||||
|
||||
var walls = Document.OfCollector().OfClass(typeof(Wall)).Cast<Wall>().ToList();
|
||||
var structuralColumns = Document.OfCollector()
|
||||
.OfClass(typeof(FamilyInstance))
|
||||
.OfCategory(BuiltInCategory.OST_StructuralColumns)
|
||||
.Cast<FamilyInstance>()
|
||||
.ToList();
|
||||
var columns = Document.OfCollector()
|
||||
.OfClass(typeof(FamilyInstance))
|
||||
.OfCategory(BuiltInCategory.OST_Columns)
|
||||
.Cast<FamilyInstance>()
|
||||
.ToList();
|
||||
var elemToSplitIds = new List<ElementId>();
|
||||
foreach (var wall in walls)
|
||||
{
|
||||
//得到墙的包围框
|
||||
var canModify = true;
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance.Host != null && instance.Host.Id == wall.Id)
|
||||
{
|
||||
errors.Add(new MessageModel(wall, "有族基于当前墙无法拆分"));
|
||||
canModify = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var walls = Document.OfCollector().OfClass(typeof(Wall)).Cast<Wall>().ToList();
|
||||
var structuralColumns = Document.OfCollector()
|
||||
.OfClass(typeof(FamilyInstance))
|
||||
.OfCategory(BuiltInCategory.OST_StructuralColumns)
|
||||
.Cast<FamilyInstance>()
|
||||
.ToList();
|
||||
var columns = Document.OfCollector()
|
||||
.OfClass(typeof(FamilyInstance))
|
||||
.OfCategory(BuiltInCategory.OST_Columns)
|
||||
.Cast<FamilyInstance>()
|
||||
.ToList();
|
||||
var elemToSplitIds = new List<ElementId>();
|
||||
foreach (var wall in walls)
|
||||
{
|
||||
//得到墙的包围框
|
||||
var canModify = true;
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance.Host != null && instance.Host.Id == wall.Id)
|
||||
{
|
||||
errors.Add(new MessageModel(wall, "有族基于当前墙无法拆分"));
|
||||
canModify = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ExporterIFCUtils.HasElevationProfile(wall))
|
||||
{
|
||||
canModify = false;
|
||||
errors.Add(new MessageModel(wall, "轮廓被修改无法拆分"));
|
||||
}
|
||||
if (ExporterIFCUtils.HasElevationProfile(wall))
|
||||
{
|
||||
canModify = false;
|
||||
errors.Add(new MessageModel(wall, "轮廓被修改无法拆分"));
|
||||
}
|
||||
|
||||
var needToDelete = false;
|
||||
if (canModify)
|
||||
{
|
||||
needToDelete = SplitWallByLevel(Document, wall, ActiveView);
|
||||
}
|
||||
var needToDelete = false;
|
||||
if (canModify)
|
||||
{
|
||||
needToDelete = SplitWallByLevel(Document, wall, ActiveView);
|
||||
}
|
||||
|
||||
if (needToDelete)
|
||||
{
|
||||
elemToSplitIds.Add(wall.Id);
|
||||
}
|
||||
}
|
||||
if (needToDelete)
|
||||
{
|
||||
elemToSplitIds.Add(wall.Id);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var column in structuralColumns)
|
||||
{
|
||||
var canModify = true;
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance.Host != null && instance.Host.Id == column.Id)
|
||||
{
|
||||
errors.Add(new MessageModel(column, "有族基于当前结构柱,无法拆分"));
|
||||
canModify = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (var column in structuralColumns)
|
||||
{
|
||||
var canModify = true;
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance.Host != null && instance.Host.Id == column.Id)
|
||||
{
|
||||
errors.Add(new MessageModel(column, "有族基于当前结构柱,无法拆分"));
|
||||
canModify = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var needToDelete = false;
|
||||
if (canModify)
|
||||
{
|
||||
needToDelete = SplitColumnByLevel(Document, column, ActiveView);
|
||||
}
|
||||
var needToDelete = false;
|
||||
if (canModify)
|
||||
{
|
||||
needToDelete = SplitColumnByLevel(Document, column, ActiveView);
|
||||
}
|
||||
|
||||
if (needToDelete)
|
||||
{
|
||||
elemToSplitIds.Add(column.Id);
|
||||
}
|
||||
}
|
||||
if (needToDelete)
|
||||
{
|
||||
elemToSplitIds.Add(column.Id);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var column in columns)
|
||||
{
|
||||
var canModify = true;
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance.Host != null && instance.Host.Id == column.Id)
|
||||
{
|
||||
errors.Add(new MessageModel(column, "有族基于当前柱,无法拆分"));
|
||||
canModify = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (var column in columns)
|
||||
{
|
||||
var canModify = true;
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance.Host != null && instance.Host.Id == column.Id)
|
||||
{
|
||||
errors.Add(new MessageModel(column, "有族基于当前柱,无法拆分"));
|
||||
canModify = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var needToDelete = false;
|
||||
if (canModify)
|
||||
{
|
||||
needToDelete = SplitColumnByLevel(Document, column, ActiveView);
|
||||
}
|
||||
var needToDelete = false;
|
||||
if (canModify)
|
||||
{
|
||||
needToDelete = SplitColumnByLevel(Document, column, ActiveView);
|
||||
}
|
||||
|
||||
if (needToDelete)
|
||||
{
|
||||
elemToSplitIds.Add(column.Id);
|
||||
}
|
||||
}
|
||||
if (needToDelete)
|
||||
{
|
||||
elemToSplitIds.Add(column.Id);
|
||||
}
|
||||
}
|
||||
|
||||
Document.Delete(elemToSplitIds);
|
||||
trans.Commit();
|
||||
}
|
||||
Document.Delete(elemToSplitIds);
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
tg.Assimilate();
|
||||
}
|
||||
tg.Assimilate();
|
||||
}
|
||||
|
||||
if (errors.Any())
|
||||
{
|
||||
if (errors.Any())
|
||||
{
|
||||
WinDialogHelper.ShowModeless<MessageWin>(new MessageViewModel(UiDocument, errors, "未解决错误"));
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("处理完成", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("处理完成", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool SplitColumnByLevel(Document document, FamilyInstance column, View view)
|
||||
{
|
||||
var wallBox = column.get_BoundingBox(view);
|
||||
var minZ = wallBox.Min.Z;
|
||||
var maxZ = wallBox.Max.Z;
|
||||
var allLevels = document
|
||||
.OfClass<Level>()
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
var toSplit = document
|
||||
.OfClass<Level>()
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.Where(l => l.Elevation - minZ > 0.0001 && maxZ - l.Elevation > 0.0001)
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
private static bool SplitColumnByLevel(Document document, FamilyInstance column, View view)
|
||||
{
|
||||
var wallBox = column.get_BoundingBox(view);
|
||||
var minZ = wallBox.Min.Z;
|
||||
var maxZ = wallBox.Max.Z;
|
||||
var allLevels = document
|
||||
.OfClass<Level>()
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
var toSplit = document
|
||||
.OfClass<Level>()
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.Where(l => l.Elevation - minZ > 0.0001 && maxZ - l.Elevation > 0.0001)
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
|
||||
if (toSplit.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (toSplit.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var n = allLevels.FindIndex(l => l.Id == toSplit[0].Id);
|
||||
var minLevel = allLevels[0];
|
||||
if (n > 0)
|
||||
{
|
||||
minLevel = allLevels[n - 1]; //存在更低的标高时,取此标高作为底标高约束
|
||||
}
|
||||
var n = allLevels.FindIndex(l => l.Id == toSplit[0].Id);
|
||||
var minLevel = allLevels[0];
|
||||
if (n > 0)
|
||||
{
|
||||
minLevel = allLevels[n - 1]; //存在更低的标高时,取此标高作为底标高约束
|
||||
}
|
||||
|
||||
var translation = XYZ.BasisZ;
|
||||
var translation = XYZ.BasisZ;
|
||||
|
||||
var bottomEleIds = ElementTransformUtils.CopyElement(document, column.Id, translation);
|
||||
var minWall = document.GetElement(bottomEleIds.FirstOrDefault()) as FamilyInstance;
|
||||
//底部约束
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(minLevel.Id);
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(minZ - minLevel.Elevation);
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(toSplit[0].Id);
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(0);
|
||||
var bottomEleIds = ElementTransformUtils.CopyElement(document, column.Id, translation);
|
||||
var minWall = document.GetElement(bottomEleIds.FirstOrDefault()) as FamilyInstance;
|
||||
//底部约束
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(minLevel.Id);
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(minZ - minLevel.Elevation);
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(toSplit[0].Id);
|
||||
minWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(0);
|
||||
|
||||
var maxLevel = toSplit.Last();
|
||||
var m = allLevels.FindIndex(l => l.Id == toSplit.Last().Id);
|
||||
if (m < allLevels.Count - 1)
|
||||
{
|
||||
maxLevel = allLevels[m + 1]; //存在更高的标高
|
||||
}
|
||||
var maxLevel = toSplit.Last();
|
||||
var m = allLevels.FindIndex(l => l.Id == toSplit.Last().Id);
|
||||
if (m < allLevels.Count - 1)
|
||||
{
|
||||
maxLevel = allLevels[m + 1]; //存在更高的标高
|
||||
}
|
||||
|
||||
var topEleIds = ElementTransformUtils.CopyElement(document, column.Id, translation);
|
||||
var maxWall = document.GetElement(topEleIds.FirstOrDefault()) as FamilyInstance;
|
||||
var topEleIds = ElementTransformUtils.CopyElement(document, column.Id, translation);
|
||||
var maxWall = document.GetElement(topEleIds.FirstOrDefault()) as FamilyInstance;
|
||||
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(toSplit.Last().Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(0);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(maxLevel.Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(maxZ - maxLevel.Elevation);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(toSplit.Last().Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(0);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(maxLevel.Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(maxZ - maxLevel.Elevation);
|
||||
|
||||
for (var i = 0; i < toSplit.Count - 1; i++)
|
||||
{
|
||||
var baseLevel = toSplit[i];
|
||||
var topLevel = toSplit[i + 1];
|
||||
var eleIds = ElementTransformUtils.CopyElement(document, column.Id, translation);
|
||||
var wallCopy = document.GetElement(eleIds.FirstOrDefault()) as FamilyInstance;
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(baseLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(0);
|
||||
for (var i = 0; i < toSplit.Count - 1; i++)
|
||||
{
|
||||
var baseLevel = toSplit[i];
|
||||
var topLevel = toSplit[i + 1];
|
||||
var eleIds = ElementTransformUtils.CopyElement(document, column.Id, translation);
|
||||
var wallCopy = document.GetElement(eleIds.FirstOrDefault()) as FamilyInstance;
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_PARAM).Set(baseLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_BASE_LEVEL_OFFSET_PARAM).Set(0);
|
||||
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(topLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(0);
|
||||
//if (i == levelsToSplit.Count - 2 && maxZ < maxLevel.Bottom)
|
||||
//{
|
||||
// wallCopy.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(maxZ - maxLevel.Bottom);
|
||||
//}
|
||||
//Wall.Create(document, curve, wall.WallType.ViewId, levels[i].ViewId, 100, 100, false, false);
|
||||
}
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_PARAM).Set(topLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.FAMILY_TOP_LEVEL_OFFSET_PARAM).Set(0);
|
||||
//if (i == levelsToSplit.Count - 2 && maxZ < maxLevel.Bottom)
|
||||
//{
|
||||
// wallCopy.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(maxZ - maxLevel.Bottom);
|
||||
//}
|
||||
//Wall.Create(document, curve, wall.WallType.ViewId, levels[i].ViewId, 100, 100, false, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切分墙体
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="wall"></param>
|
||||
/// <param name="view">三维视图</param>
|
||||
/// <returns></returns>
|
||||
private static bool SplitWallByLevel(Document doc, Wall wall, View view)
|
||||
{
|
||||
var wallBox = wall.get_BoundingBox(view);
|
||||
var minZ = wallBox.Min.Z;
|
||||
var maxZ = wallBox.Max.Z;
|
||||
var allLevels = new FilteredElementCollector(doc)
|
||||
.OfClass(typeof(Level))
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
var toSplit = new FilteredElementCollector(doc)
|
||||
.OfClass(typeof(Level))
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.Where(l => l.Elevation - minZ > 0.0001 && maxZ - l.Elevation > 0.0001)
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
/// <summary>
|
||||
/// 切分墙体
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="wall"></param>
|
||||
/// <param name="view">三维视图</param>
|
||||
/// <returns></returns>
|
||||
private static bool SplitWallByLevel(Document doc, Wall wall, View view)
|
||||
{
|
||||
var wallBox = wall.get_BoundingBox(view);
|
||||
var minZ = wallBox.Min.Z;
|
||||
var maxZ = wallBox.Max.Z;
|
||||
var allLevels = new FilteredElementCollector(doc)
|
||||
.OfClass(typeof(Level))
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
var toSplit = new FilteredElementCollector(doc)
|
||||
.OfClass(typeof(Level))
|
||||
.OfCategory(BuiltInCategory.OST_Levels)
|
||||
.Cast<Level>()
|
||||
.Where(l => l.Elevation - minZ > 0.0001 && maxZ - l.Elevation > 0.0001)
|
||||
.OrderBy(o => o.Elevation)
|
||||
.ToList();
|
||||
|
||||
if (toSplit.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (toSplit.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var n = allLevels.FindIndex(l => l.Id == toSplit[0].Id);
|
||||
var minLevel = allLevels[0];
|
||||
if (n > 0)
|
||||
{
|
||||
minLevel = allLevels[n - 1]; //存在更低的标高时,取此标高作为底标高约束
|
||||
}
|
||||
var n = allLevels.FindIndex(l => l.Id == toSplit[0].Id);
|
||||
var minLevel = allLevels[0];
|
||||
if (n > 0)
|
||||
{
|
||||
minLevel = allLevels[n - 1]; //存在更低的标高时,取此标高作为底标高约束
|
||||
}
|
||||
|
||||
var translation = XYZ.BasisZ;
|
||||
var bottomEleIds = ElementTransformUtils.CopyElement(doc, wall.Id, translation);
|
||||
var minWall = doc.GetElement(bottomEleIds.FirstOrDefault()) as Wall;
|
||||
//底部约束
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(minLevel.Id);
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(minZ - minLevel.Elevation);
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(toSplit[0].Id);
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(0);
|
||||
var translation = XYZ.BasisZ;
|
||||
var bottomEleIds = ElementTransformUtils.CopyElement(doc, wall.Id, translation);
|
||||
var minWall = doc.GetElement(bottomEleIds.FirstOrDefault()) as Wall;
|
||||
//底部约束
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(minLevel.Id);
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(minZ - minLevel.Elevation);
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(toSplit[0].Id);
|
||||
minWall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(0);
|
||||
|
||||
//Wall.Create(doc, (wall.Location as LocationCurve).Curve, wall.WallType.Id, minLevel.Id, minLevel.Bottom - minZ, minZ - minLevel.Bottom, wall.Flipped, Convert.ToBoolean(wall.get_Parameter(BuiltInParameter.WALL_STRUCTURAL_SIGNIFICANT).AsInteger()));
|
||||
//Wall.Create(doc, (wall.Location as LocationCurve).Curve, wall.WallType.Id, minLevel.Id, minLevel.Bottom - minZ, minZ - minLevel.Bottom, wall.Flipped, Convert.ToBoolean(wall.get_Parameter(BuiltInParameter.WALL_STRUCTURAL_SIGNIFICANT).AsInteger()));
|
||||
|
||||
var maxLevel = toSplit.Last();
|
||||
var m = allLevels.FindIndex(l => l.Id == toSplit.Last().Id);
|
||||
if (m < allLevels.Count - 1)
|
||||
{
|
||||
maxLevel = allLevels[m + 1]; //存在更高的标高
|
||||
}
|
||||
var maxLevel = toSplit.Last();
|
||||
var m = allLevels.FindIndex(l => l.Id == toSplit.Last().Id);
|
||||
if (m < allLevels.Count - 1)
|
||||
{
|
||||
maxLevel = allLevels[m + 1]; //存在更高的标高
|
||||
}
|
||||
|
||||
var topEleIds = ElementTransformUtils.CopyElement(doc, wall.Id, translation);
|
||||
doc.Regenerate();
|
||||
var maxWall = doc.GetElement(topEleIds.FirstOrDefault()) as Wall;
|
||||
var topEleIds = ElementTransformUtils.CopyElement(doc, wall.Id, translation);
|
||||
doc.Regenerate();
|
||||
var maxWall = doc.GetElement(topEleIds.FirstOrDefault()) as Wall;
|
||||
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(toSplit.Last().Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(0);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(maxLevel.Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(maxZ - maxLevel.Elevation);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(toSplit.Last().Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(0);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(maxLevel.Id);
|
||||
maxWall.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(maxZ - maxLevel.Elevation);
|
||||
|
||||
for (var i = 0; i < toSplit.Count - 1; i++)
|
||||
{
|
||||
var baseLevel = toSplit[i];
|
||||
var topLevel = toSplit[i + 1];
|
||||
var eleIds = ElementTransformUtils.CopyElement(doc, wall.Id, translation);
|
||||
doc.Regenerate();
|
||||
var wallCopy = doc.GetElement(eleIds.FirstOrDefault()) as Wall;
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(baseLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(0);
|
||||
for (var i = 0; i < toSplit.Count - 1; i++)
|
||||
{
|
||||
var baseLevel = toSplit[i];
|
||||
var topLevel = toSplit[i + 1];
|
||||
var eleIds = ElementTransformUtils.CopyElement(doc, wall.Id, translation);
|
||||
doc.Regenerate();
|
||||
var wallCopy = doc.GetElement(eleIds.FirstOrDefault()) as Wall;
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_BASE_CONSTRAINT).Set(baseLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_BASE_OFFSET).Set(0);
|
||||
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(topLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(0);
|
||||
//if (i == levelsToSplit.Count - 2 && maxZ < maxLevel.Bottom)
|
||||
//{
|
||||
// wallCopy.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(maxZ - maxLevel.Bottom);
|
||||
//}
|
||||
//Wall.Create(document, curve, wall.WallType.ViewId, levels[i].ViewId, 100, 100, false, false);
|
||||
}
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE).Set(topLevel.Id);
|
||||
wallCopy.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(0);
|
||||
//if (i == levelsToSplit.Count - 2 && maxZ < maxLevel.Bottom)
|
||||
//{
|
||||
// wallCopy.get_Parameter(BuiltInParameter.WALL_TOP_OFFSET).Set(maxZ - maxLevel.Bottom);
|
||||
//}
|
||||
//Wall.Create(document, curve, wall.WallType.ViewId, levels[i].ViewId, 100, 100, false, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:attach="clr-namespace:ShrlAlgoToolkit.Mvvm.Attach;assembly=ShrlAlgoToolkit.Mvvm"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvFamily"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="https://github.com/ShrlAlgo/NeoUI"
|
||||
@@ -27,43 +28,17 @@
|
||||
Rows="*,Auto,Auto">
|
||||
<GroupBox Header="族类别">
|
||||
<ListBox
|
||||
Style="{StaticResource ChipListBoxStyle}"
|
||||
x:Name="LbCategories"
|
||||
Height="400"
|
||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{Binding Collection, Mode=OneWay}"
|
||||
SelectionMode="Multiple">
|
||||
<!-- <ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>-->
|
||||
<!-- <ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>-->
|
||||
<!-- <ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border CornerRadius="5" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>-->
|
||||
<!-- <ListBox.ItemContainerStyle>
|
||||
<Style />
|
||||
</ListBox.ItemContainerStyle>-->
|
||||
<b:Interaction.Triggers>
|
||||
<b:EventTrigger EventName="SelectionChanged">
|
||||
<b:InvokeCommandAction Command="{Binding GetRenameItemsCommand}" CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}" />
|
||||
</b:EventTrigger>
|
||||
</b:Interaction.Triggers>
|
||||
<!-- <ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="{Binding Value}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>-->
|
||||
</ListBox>
|
||||
</GroupBox>
|
||||
<DockPanel>
|
||||
@@ -97,12 +72,12 @@
|
||||
ItemsSource="{Binding RenameItems}"
|
||||
SelectionUnit="Cell">
|
||||
<DataGrid.Resources>
|
||||
<Style BasedOn="{StaticResource DefaultDataGridCellStyle}" TargetType="{x:Type DataGridCell}">
|
||||
<Style BasedOn="{StaticResource DataGridCellDefault}" TargetType="{x:Type DataGridCell}">
|
||||
<!-- <Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />-->
|
||||
<Setter Property="attach:TextSearchAssist.IsTextMatch">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource SearchFamilyValueConverter}">
|
||||
<MultiBinding Converter="{x:Static conv:SearchFamilyValueConverter.Instance}">
|
||||
<Binding Path="Content.Text" RelativeSource="{RelativeSource Mode=Self}" />
|
||||
<Binding Path="(attach:TextSearchAssist.SearchValue)" RelativeSource="{RelativeSource Mode=Self}" />
|
||||
<Binding RelativeSource="{RelativeSource Mode=Self}" />
|
||||
@@ -117,7 +92,7 @@
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style BasedOn="{StaticResource DefaultDataGridColumnHeaderStyle}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Style BasedOn="{StaticResource DataGridColumnHeaderDefault}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
@@ -125,8 +100,8 @@
|
||||
<DataGridCheckBoxColumn
|
||||
MinWidth="80"
|
||||
Binding="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}"
|
||||
EditingElementStyle="{StaticResource DataGridCheckBoxEditingElementDefaultStyle}"
|
||||
ElementStyle="{StaticResource DataGridCheckBoxElementDefaultStyle}">
|
||||
EditingElementStyle="{StaticResource DataGridCheckBox}"
|
||||
ElementStyle="{StaticResource DataGridCheckBox}">
|
||||
<DataGridCheckBoxColumn.Header>
|
||||
<Border Background="Transparent">
|
||||
<CheckBox
|
||||
@@ -168,7 +143,7 @@
|
||||
<DataGridTextColumn
|
||||
MinWidth="80"
|
||||
Binding="{Binding NewFamilyName, UpdateSourceTrigger=PropertyChanged}"
|
||||
EditingElementStyle="{StaticResource DefaultTextBoxStyle}"
|
||||
EditingElementStyle="{StaticResource DefaultTextBox}"
|
||||
Header="新族名称">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
Width="900"
|
||||
d:DataContext="{d:DesignInstance local:RenameTypeViewModel}"
|
||||
mc:Ignorable="d"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
x:Class="ShrlAlgoToolkit.RevitAddins.RvFamily.RenameTypeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:attach="clr-namespace:ShrlAlgoToolkit.Mvvm.Attach;assembly=ShrlAlgoToolkit.Mvvm"
|
||||
@@ -27,6 +28,7 @@
|
||||
Rows="*,Auto,Auto">
|
||||
<GroupBox Header="族类别">
|
||||
<ListBox
|
||||
Style="{StaticResource ChipListBoxStyle}"
|
||||
DisplayMemberPath="Key"
|
||||
ItemsSource="{Binding Collection, Mode=OneWay}"
|
||||
SelectionMode="Multiple"
|
||||
@@ -86,10 +88,10 @@
|
||||
SelectionUnit="Cell"
|
||||
attach:TextSearchAssist.SearchValue="{Binding Text, ElementName=TbFound, UpdateSourceTrigger=PropertyChanged}">
|
||||
<DataGrid.Resources>
|
||||
<Style BasedOn="{StaticResource DefaultDataGridCellStyle}" TargetType="{x:Type DataGridCell}">
|
||||
<Style BasedOn="{StaticResource DataGridCellDefault}" TargetType="{x:Type DataGridCell}">
|
||||
<Setter Property="attach:TextSearchAssist.IsTextMatch">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource SearchTypeValueConverter}">
|
||||
<MultiBinding Converter="{x:Static conv:SearchTypeValueConverter.Instance}">
|
||||
<Binding Path="Content.Text" RelativeSource="{RelativeSource Mode=Self}" />
|
||||
<Binding Path="(attach:TextSearchAssist.SearchValue)" RelativeSource="{RelativeSource Mode=Self}" />
|
||||
<Binding RelativeSource="{RelativeSource Mode=Self}" />
|
||||
@@ -104,7 +106,7 @@
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style BasedOn="{StaticResource DefaultDataGridColumnHeaderStyle}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Style BasedOn="{StaticResource DataGridColumnHeaderDefault}" TargetType="{x:Type DataGridColumnHeader}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
@@ -112,8 +114,8 @@
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn
|
||||
Binding="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}"
|
||||
EditingElementStyle="{StaticResource DataGridCheckBoxEditingElementDefaultStyle}"
|
||||
ElementStyle="{StaticResource DataGridCheckBoxElementDefaultStyle}">
|
||||
EditingElementStyle="{StaticResource DataGridCheckBox}"
|
||||
ElementStyle="{StaticResource DataGridCheckBox}">
|
||||
<DataGridCheckBoxColumn.Header>
|
||||
<CheckBox
|
||||
Content="全选"
|
||||
@@ -159,7 +161,7 @@
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn
|
||||
Binding="{Binding NewTypeName, UpdateSourceTrigger=PropertyChanged}"
|
||||
EditingElementStyle="{StaticResource DefaultTextBoxStyle}"
|
||||
EditingElementStyle="{StaticResource DefaultTextBox}"
|
||||
Header="新族类型名称"
|
||||
MinWidth="80">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
@@ -177,7 +179,7 @@
|
||||
IsEnabled="{Binding CanInput}"
|
||||
Margin="5"
|
||||
ui:InputAssist.Placeholder="前缀">
|
||||
<Binding Path="ui:InputAssist.PrefixText" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding Path="PrefixText" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
||||
</Binding.ValidationRules>
|
||||
@@ -187,7 +189,7 @@
|
||||
IsEnabled="{Binding CanInput}"
|
||||
Margin="5"
|
||||
ui:InputAssist.Placeholder="后缀">
|
||||
<Binding Path="ui:InputAssist.SuffixText" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding Path="SuffixText" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<validationRules:UndefinedCharRules ValidatesOnTargetUpdated="True" />
|
||||
</Binding.ValidationRules>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<ui:NeoWindow
|
||||
Height="100"
|
||||
Height="150"
|
||||
MinHeight="110"
|
||||
Title="物探管网"
|
||||
Width="500"
|
||||
|
||||
@@ -110,6 +110,6 @@
|
||||
Command="{Binding ConnectCommand}"
|
||||
Content="连接管线"
|
||||
HorizontalAlignment="Stretch"
|
||||
ui:ButtonAssist.Icon="PlugConnect" />
|
||||
ui:ButtonAssist.Icon="{ui:Icon SymbolValue=PlugConnect}" />
|
||||
</ui:StackPanel>
|
||||
</ui:NeoWindow>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using Nice3point.Revit.Toolkit.External;
|
||||
|
||||
|
||||
@@ -11,27 +12,34 @@ namespace ShrlAlgoToolkit.RevitAddins.RvMEP
|
||||
{
|
||||
public override void Execute()
|
||||
{
|
||||
ICollection<FamilyInstance> familyInstances;
|
||||
if (UiDocument.Selection.GetElementIds().Count > 0)
|
||||
try
|
||||
{
|
||||
ICollection<FamilyInstance> familyInstances;
|
||||
if (UiDocument.Selection.GetElementIds().Count > 0)
|
||||
{
|
||||
familyInstances = UiDocument.Selection.GetElementIds().Select(Document.GetElement).OfType<FamilyInstance>().ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
familyInstances = UiDocument.SelectObjects<FamilyInstance>("请选择族实例");
|
||||
}
|
||||
Document.Invoke(
|
||||
ts =>
|
||||
{
|
||||
foreach (var ins in familyInstances)
|
||||
{
|
||||
if (ins.CanFlipWorkPlane)
|
||||
{
|
||||
ins.IsWorkPlaneFlipped = !ins.IsWorkPlaneFlipped;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
familyInstances = UiDocument.Selection.GetElementIds().Select(Document.GetElement).OfType<FamilyInstance>().ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
familyInstances = UiDocument.SelectObjects<FamilyInstance>("请选择族实例");
|
||||
}
|
||||
Document.Invoke(
|
||||
ts =>
|
||||
{
|
||||
foreach (var ins in familyInstances)
|
||||
{
|
||||
if (ins.CanFlipWorkPlane)
|
||||
{
|
||||
ins.IsWorkPlaneFlipped = !ins.IsWorkPlaneFlipped;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
x:Class="ShrlAlgoToolkit.RevitAddins.RvMEP.HeadroomCheckView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:conv="clr-namespace:ShrlAlgoToolkit.RevitAddins.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ShrlAlgoToolkit.RevitAddins.RvMEP"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -36,7 +37,7 @@
|
||||
<DataGrid.Columns>
|
||||
<DataGridCheckBoxColumn
|
||||
Binding="{Binding IsSelected}"
|
||||
ElementStyle="{StaticResource DataGridCheckBoxElementDefaultStyle}"
|
||||
ElementStyle="{StaticResource DataGridCheckBox}"
|
||||
Header="选择"
|
||||
Width="60" />
|
||||
<DataGridTextColumn
|
||||
@@ -46,7 +47,7 @@
|
||||
<DataGridTemplateColumn Header="颜色" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="{Binding Color, Converter={StaticResource Revit2MediaColorConverter}}" ToolTip="生成三维房间时的颜色" />
|
||||
<Border Background="{Binding Color, Converter={x:Static conv:Rv2WinColorConverter.Instance}}" ToolTip="生成三维房间时的颜色" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
</RadioButton.IsChecked>
|
||||
</RadioButton>
|
||||
<RadioButton Content="自定义" x:Name="LbCustom" />
|
||||
<TextBox Text="{Binding Angle, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=LbCustom}" />
|
||||
<TextBox Text="{Binding Angle, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding IsChecked, Converter={x:Static ui:BooleanToVisibilityConverter.CollapsedInstance}, ElementName=LbCustom}" />
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
<CheckBox
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
Content="编辑" />
|
||||
</Border>
|
||||
|
||||
<!--<syncfusion:ColorPicker Color="{Binding FillColor, Converter={StaticResource Revit2MediaColorConverter}, UpdateSourceTrigger=PropertyChanged}" />-->
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
Reference in New Issue
Block a user