更新窗口的snap layouts和tab样式
This commit is contained in:
@@ -35,21 +35,21 @@ public class WindowAssist
|
||||
/// 附加属性,用于手动控制控件的视觉状态。
|
||||
/// XAML中的Triggers将绑定到此属性,而不是IsMouseOver或IsPressed。
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty VisualStateProperty =
|
||||
public static readonly DependencyProperty WindowButtonStateProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"VisualState", // 属性名
|
||||
"WindowButtonState", // 属性名
|
||||
typeof(WindowButtonState), // 属性类型 (我们定义的枚举)
|
||||
typeof(WindowAssist), // 拥有者类
|
||||
new PropertyMetadata(WindowButtonState.Normal)); // 默认值
|
||||
|
||||
public static WindowButtonState GetVisualState(DependencyObject obj)
|
||||
public static WindowButtonState GetWindowButtonState(DependencyObject obj)
|
||||
{
|
||||
return (WindowButtonState)obj.GetValue(VisualStateProperty);
|
||||
return (WindowButtonState)obj.GetValue(WindowButtonStateProperty);
|
||||
}
|
||||
|
||||
public static void SetVisualState(DependencyObject obj, WindowButtonState value)
|
||||
public static void SetWindowButtonState(DependencyObject obj, WindowButtonState value)
|
||||
{
|
||||
obj.SetValue(VisualStateProperty, value);
|
||||
obj.SetValue(WindowButtonStateProperty, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
<StackPanel>
|
||||
<ToggleButton
|
||||
x:Name="HeaderButton"
|
||||
Padding="5"
|
||||
Padding="6"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="0,0,0,1"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
Cursor="Hand"
|
||||
@@ -69,6 +67,7 @@
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
</ToggleButton>
|
||||
<Rectangle Margin="-4,0" x:Name="Divider" Height="1" Fill="{DynamicResource BorderNormalBrush}"/>
|
||||
<Border
|
||||
x:Name="ContentSiteWrapper"
|
||||
ClipToBounds="True"
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:markup="clr-namespace:NeoUI.Markup"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:markup="clr-namespace:NeoUI.Markup">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/NeoUI;component/Animations/Animations.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
@@ -74,11 +75,85 @@
|
||||
To="0.5"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
|
||||
<Style x:Key="IconButton" TargetType="Button">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="assists:ButtonAssist.Icon" Value="{x:Null}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid>
|
||||
<decorations:EmbossBorder
|
||||
x:Name="emboss"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Intensity="0.8"
|
||||
ShaderEnabled="True" />
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Width="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight}"
|
||||
Height="{TemplateBinding Width}"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Intensity="0"
|
||||
ShaderEnabled="False">
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{Binding Path=(assists:ButtonAssist.Icon), RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
</decorations:SlotBorder>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True" />
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="1" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="0.4" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="slot" Property="ShaderEnabled" Value="True" />
|
||||
<Setter TargetName="slot" Property="Intensity" Value="0.6" />
|
||||
<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="emboss" Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<!--<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />-->
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- 拟态按钮,按下后显示深度效果 -->
|
||||
<Style x:Key="NeuButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="10,4" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
@@ -89,13 +164,16 @@
|
||||
<decorations:EmbossBorder
|
||||
x:Name="emboss"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0.5"
|
||||
Intensity="0.8"
|
||||
ShaderEnabled="True" />
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Margin="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0"
|
||||
ShaderEnabled="False">
|
||||
<ContentPresenter
|
||||
@@ -115,14 +193,13 @@
|
||||
<!--<Setter Property="BorderThickness" Value="1" />-->
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="slot" Property="Intensity" Value="0" />
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="0" />
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="0.4" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="slot" Property="ShaderEnabled" Value="True" />
|
||||
<Setter TargetName="slot" Property="Intensity" Value="0.6" />
|
||||
<Setter TargetName="emboss" Property="Intensity" Value="0" />
|
||||
<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />
|
||||
<Setter TargetName="slot" Property="Foreground" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
@@ -130,7 +207,6 @@
|
||||
<Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<!--<Setter TargetName="emboss" Property="ShaderEnabled" Value="False" />-->
|
||||
</Trigger>
|
||||
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
@@ -206,10 +282,6 @@
|
||||
</decorations:EmbossBorder>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<!--<Trigger Property="IsDefaulted" Value="True">
|
||||
<Setter Property="BorderBrush" TargetName="border"
|
||||
Value="{StaticResource PrimaryBrush}" />
|
||||
</Trigger>-->
|
||||
<!-- 前缀图标可见性 -->
|
||||
<Trigger Property="assists:ButtonAssist.Icon" Value="{x:Null}">
|
||||
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<Setter Property="Intensity" Value="1" />
|
||||
<Setter Property="LightShadowBrush" Value="{DynamicResource LightShadowBrush}" />
|
||||
<Setter Property="DarkShadowBrush" Value="{DynamicResource DarkShadowBrush}" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type decorations:EmbossBorder}">
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
|
||||
<Style TargetType="{x:Type decorations:LightedSurface}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="LightColorBrush" Value="#FF111319" />
|
||||
<Setter Property="LightSize" Value="200" />
|
||||
<Setter Property="Padding" Value="5" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
@@ -19,32 +19,32 @@
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="ShowLight">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
Storyboard.TargetProperty="LightIntensity"
|
||||
To="1" />
|
||||
To="1"
|
||||
Duration="0:0:0.2" />
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="HideLight">
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
Storyboard.TargetProperty="LightIntensity"
|
||||
To="0" />
|
||||
To="0"
|
||||
Duration="0:0:0.2" />
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Border
|
||||
x:Name="PART_lightBorder"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
x:Name="PART_lightBorder">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ContentPresenter
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
</Border>
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ContentPresenter
|
||||
x:Name="contentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Focusable="False"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
<!-- 不支持垂直方向 -->
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal">
|
||||
|
||||
<Style x:Key="SlideTabGroupListBoxStyle" TargetType="ListBox">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
@@ -28,6 +28,14 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Grid Background="Transparent">
|
||||
<!-- 选中指示器 -->
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Padding="-4"
|
||||
CornerRadius="{Binding Path=(assists:ControlAssist.CornerRadius), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
|
||||
Intensity="0.2"
|
||||
Visibility="Collapsed"
|
||||
ShaderEnabled="False"/>
|
||||
<ContentPresenter
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
@@ -38,8 +46,18 @@
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<!-- 被选中时,仅改变文字颜色 -->
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<!-- 主题高亮颜色 -->
|
||||
<Setter TargetName="slot" Property="ShaderEnabled" Value="True" />
|
||||
</Trigger>
|
||||
<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>
|
||||
<DataTrigger Binding="{Binding Path=SelectionMode, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" Value="Extend">
|
||||
<Setter TargetName="slot" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
@@ -63,7 +81,7 @@
|
||||
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
||||
Intensity="0.8" />
|
||||
<!-- Canvas 用于精确定位滑块 -->
|
||||
<Canvas>
|
||||
<Canvas x:Name="PART_SlideCanvas">
|
||||
<!-- 滑块元素,Name 是关键,行为代码通过它来查找并控制动画 -->
|
||||
<decorations:SlotBorder
|
||||
x:Name="PART_SelectionIndicator"
|
||||
@@ -76,10 +94,21 @@
|
||||
</decorations:SlotBorder.RenderTransform>
|
||||
</decorations:SlotBorder>
|
||||
</Canvas>
|
||||
|
||||
<!-- ItemsPresenter 必须在滑块上层,以显示所有 Tab 项 -->
|
||||
<ItemsPresenter />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<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>
|
||||
<Trigger Property="SelectionMode" Value="Extended">
|
||||
<Setter TargetName="PART_SlideCanvas" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@@ -89,9 +118,7 @@
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="assists:SelectorAssist.Orientation" Value="Horizontal" />
|
||||
|
||||
<Setter Property="assists:ControlAssist.CornerRadius" Value="10" />
|
||||
<!-- 关键:将上面定义的Item样式应用到ListBox的每个项目上 -->
|
||||
<Setter Property="ItemContainerStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="{x:Type ListBoxItem}">
|
||||
@@ -121,10 +148,6 @@
|
||||
<Setter TargetName="emboss" Property="ShaderEnabled" Value="True" />
|
||||
<Setter TargetName="emboss" Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
@@ -148,6 +171,9 @@
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<!--<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>-->
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<!--<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>-->
|
||||
@@ -42,7 +41,7 @@
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<!--<Condition Property="IsMouseOver" Value="True" />-->
|
||||
<Condition Property="assists:WindowAssist.VisualState" Value="MouseOver" />
|
||||
<Condition Property="assists:WindowAssist.WindowButtonState" Value="MouseOver" />
|
||||
<Condition Property="Background" Value="Transparent" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="border" Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||||
@@ -54,7 +53,7 @@
|
||||
<Setter Property="Opacity" Value="1" />
|
||||
</MultiTrigger>
|
||||
<!--<Trigger Property="IsPressed" Value="True">-->
|
||||
<Trigger Property="assists:WindowAssist.VisualState" Value="Pressed">
|
||||
<Trigger Property="assists:WindowAssist.WindowButtonState" Value="Pressed">
|
||||
<Setter TargetName="border" Property="Effect">
|
||||
<Setter.Value>
|
||||
<effects:BrightnessContrastEffect Brightness="0.05" />
|
||||
@@ -319,7 +318,7 @@
|
||||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<!--<Trigger Property="IsMouseOver" Value="True">-->
|
||||
<Trigger Property="assists:WindowAssist.VisualState" Value="MouseOver">
|
||||
<Trigger Property="assists:WindowAssist.WindowButtonState" Value="MouseOver">
|
||||
<Setter Property="Background" Value="{DynamicResource ErrorBrush}" />
|
||||
<Setter Property="Foreground" Value="#e0e0e0" />
|
||||
</Trigger>
|
||||
|
||||
@@ -79,7 +79,7 @@ public class NeoWindow : Window
|
||||
{
|
||||
pressedButton = hoveredButton;
|
||||
// 3. 设置状态为 Pressed
|
||||
WindowAssist.SetVisualState(pressedButton, WindowButtonState.Pressed);
|
||||
WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Pressed);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
@@ -116,7 +116,7 @@ public class NeoWindow : Window
|
||||
// 离开旧按钮:如果之前有悬停的按钮,并且它当前不是"按下"状态,则恢复为"Normal"
|
||||
if (hoveredButton != null && hoveredButton != pressedButton)
|
||||
{
|
||||
WindowAssist.SetVisualState(hoveredButton, WindowButtonState.Normal);
|
||||
WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.Normal);
|
||||
}
|
||||
|
||||
hoveredButton = currentHoveredButton;
|
||||
@@ -124,7 +124,7 @@ public class NeoWindow : Window
|
||||
// 进入新按钮:如果现在有一个新的悬停按钮,并且它当前不是"按下"状态,则切换为"MouseOver"
|
||||
if (hoveredButton != null && hoveredButton != pressedButton)
|
||||
{
|
||||
WindowAssist.SetVisualState(hoveredButton, WindowButtonState.MouseOver);
|
||||
WindowAssist.SetWindowButtonState(hoveredButton, WindowButtonState.MouseOver);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class NeoWindow : Window
|
||||
{
|
||||
if (pressedButton != null)
|
||||
{
|
||||
WindowAssist.SetVisualState(pressedButton, WindowButtonState.Normal);
|
||||
WindowAssist.SetWindowButtonState(pressedButton, WindowButtonState.Normal);
|
||||
pressedButton = null;
|
||||
}
|
||||
UpdateHoverState(null);
|
||||
|
||||
@@ -397,7 +397,7 @@
|
||||
Content="禁用按钮"
|
||||
IsEnabled="False" />
|
||||
|
||||
<Button Content="拟态" Style="{StaticResource NeuButtonStyle}" />
|
||||
<Button Content="拟态" Style="{StaticResource NeuButtonStyle}"/>
|
||||
<Button
|
||||
Content="禁用拟态"
|
||||
IsEnabled="False"
|
||||
@@ -468,6 +468,10 @@
|
||||
<RepeatButton Content="RepeatButton" />
|
||||
<RepeatButton Content="RepeatButton" IsEnabled="False" />
|
||||
</UniformGrid>
|
||||
<UniformGrid Rows="1">
|
||||
<Button Style="{StaticResource IconButton}" n:ButtonAssist.Icon="{n:Icon SymbolValue=Add}"/>
|
||||
<Button IsEnabled="False" Style="{StaticResource IconButton}" n:ButtonAssist.Icon="{n:Icon SymbolValue=Add}"/>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -988,8 +992,7 @@
|
||||
<TreeViewItem Header="A123" IsExpanded="True">
|
||||
<TreeViewItem
|
||||
Header="B123"
|
||||
IsExpanded="True"
|
||||
IsSelected="True">
|
||||
IsExpanded="True">
|
||||
<TreeViewItem Header="C123" />
|
||||
</TreeViewItem>
|
||||
<TreeViewItem Header="B456" IsEnabled="False" />
|
||||
@@ -1043,7 +1046,7 @@
|
||||
</ListView>
|
||||
|
||||
</n:FlexibleRowPanel>
|
||||
<n:FlexibleRowPanel LayoutMode="Auto" Spacing="100">
|
||||
<n:FlexibleRowPanel LayoutMode="Auto" Spacing="20">
|
||||
<UniformGrid Columns="1">
|
||||
<ListBox
|
||||
HorizontalAlignment="Center"
|
||||
@@ -1066,8 +1069,33 @@
|
||||
<sys:String>Tab 3</sys:String>
|
||||
<sys:String>Another Tab</sys:String>
|
||||
</ListBox>
|
||||
<ListBox
|
||||
IsEnabled="False"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
n:ListBoxSlideBehavior.EnableSlideAnimation="True"
|
||||
SelectedIndex="1"
|
||||
Style="{StaticResource SlideTabGroupListBoxStyle}">
|
||||
<!-- 这里是你的数据项 -->
|
||||
<sys:String>Tab 1</sys:String>
|
||||
<sys:String>Tab 2</sys:String>
|
||||
<sys:String>Tab 3</sys:String>
|
||||
<sys:String>Another Tab</sys:String>
|
||||
</ListBox>
|
||||
</UniformGrid>
|
||||
<ListBox
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
n:SelectorAssist.Orientation="Vertical"
|
||||
SelectedIndex="1"
|
||||
SelectionMode="Multiple"
|
||||
Style="{StaticResource TabGroupListBoxStyle}">
|
||||
<ListBoxItem Content="Home" />
|
||||
<ListBoxItem Content="Away" />
|
||||
<ListBoxItem Content="Night" />
|
||||
</ListBox>
|
||||
<ListBox
|
||||
IsEnabled="False"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
n:SelectorAssist.Orientation="Vertical"
|
||||
@@ -1078,6 +1106,7 @@
|
||||
<ListBoxItem Content="Night" />
|
||||
</ListBox>
|
||||
<ListBox
|
||||
SelectionMode="Multiple"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
n:ListBoxSlideBehavior.EnableSlideAnimation="True"
|
||||
@@ -1190,15 +1219,15 @@
|
||||
ToolTip="双击展开详情">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<i:InvokeCommandAction Command="{Binding ToggleDetailsCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=DataGrid}, Path=SelectedItem}" />
|
||||
<i:InvokeCommandAction Command="{Binding ToggleDetailsCommand}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<!-- 2. RowStyle现在只负责绑定详情可见性,不再处理事件 -->
|
||||
<DataGrid.RowStyle>
|
||||
<Style BasedOn="{StaticResource DataGridRowDefault}" TargetType="DataGridRow">
|
||||
<n:NeuDataGrid.RowStyle>
|
||||
<Style BasedOn="{StaticResource DataGridRowDefault}" TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="DetailsVisibility" Value="{Binding IsDetailsVisible, Converter={x:Static n:BooleanToVisibilityConverter.CollapsedInstance}, Mode=TwoWay}" />
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</n:NeuDataGrid.RowStyle>
|
||||
<n:NeuDataGrid.RowDetailsTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="10">
|
||||
@@ -1228,7 +1257,7 @@
|
||||
<HierarchicalDataTemplate DataType="{x:Type neuwpftest:TreeNodeItem}" ItemsSource="{Binding Children}">
|
||||
<!-- 使用 GridViewRowPresenter 来确保内容与表头列对齐 -->
|
||||
<!-- Columns 属性必须绑定到 TreeGrid 的 Columns 集合 -->
|
||||
<GridViewRowPresenter Columns="{Binding Path=Columns, RelativeSource={RelativeSource AncestorType=n:TreeGrid}}" Content="{Binding}" />
|
||||
<GridViewRowPresenter Columns="{Binding Columns, RelativeSource={RelativeSource AncestorType={x:Type n:TreeGrid}}}" Content="{Binding}" />
|
||||
</HierarchicalDataTemplate>
|
||||
</n:TreeGrid.ItemTemplate>
|
||||
<!-- 直接定义 GridViewColumn 集合,就像使用 ListView 一样 -->
|
||||
@@ -1261,7 +1290,7 @@
|
||||
Width="200"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1">
|
||||
<n:AccordionItem Header="User Profile">
|
||||
<n:AccordionItem Header="User Profile" IsExpanded="True">
|
||||
<StackPanel Margin="10">
|
||||
<TextBlock Text="Name: John Doe" />
|
||||
<TextBlock Text="Email: john.doe@example.com" />
|
||||
@@ -1279,13 +1308,13 @@
|
||||
<TextBlock Text="Email: john.doe@example.com" />
|
||||
</StackPanel>
|
||||
</n:AccordionItem>
|
||||
<n:AccordionItem Header="Application Settings">
|
||||
<StackPanel Margin="10">
|
||||
<n:AccordionItem Header="Application Settings" IsExpanded="True">
|
||||
<StackPanel>
|
||||
<CheckBox Content="Enable Dark Mode" />
|
||||
<CheckBox Content="Auto-save every 5 minutes" />
|
||||
</StackPanel>
|
||||
</n:AccordionItem>
|
||||
<n:AccordionItem Header="Help & Support">
|
||||
<n:AccordionItem Header="Help & Support" IsExpanded="True">
|
||||
<TextBlock
|
||||
Margin="10"
|
||||
Text="For support, please visit our website."
|
||||
@@ -1297,7 +1326,7 @@
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding Items}">
|
||||
<n:Accordion.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource {x:Type n:AccordionItem}}" TargetType="n:AccordionItem">
|
||||
<Style BasedOn="{StaticResource {x:Type n:AccordionItem}}" TargetType="{x:Type n:AccordionItem}">
|
||||
<Setter Property="Header" Value="{Binding Label}" />
|
||||
<Setter Property="Content">
|
||||
<Setter.Value>
|
||||
|
||||
Reference in New Issue
Block a user