更新命名空间,优化部分交互
This commit is contained in:
140
NeoUI/NeoUI/Assists/PopupAssist.cs
Normal file
140
NeoUI/NeoUI/Assists/PopupAssist.cs
Normal file
@@ -0,0 +1,140 @@
|
||||
// NeoUI/Assists/PopupAssist.cs
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace NeoUI.Assists
|
||||
{
|
||||
/// <summary>
|
||||
/// 提供附加属性,为 StaysOpen="True" 的 Popup 附加原生 ComboBox 的标准行为。
|
||||
/// 当 SimulateNativeBehavior="True" 时:
|
||||
/// 1. 点击外部、拖动窗口或窗口失活时,Popup 会自动关闭。
|
||||
/// 2. Popup 打开时,会阻止外部内容的鼠标滚轮滚动。
|
||||
/// </summary>
|
||||
public static class PopupAssist
|
||||
{
|
||||
#region SimulateNativeBehavior Attached Property
|
||||
|
||||
public static readonly DependencyProperty SimulateNativeBehaviorProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"SimulateNativeBehavior", // 【命名已更新】
|
||||
typeof(bool),
|
||||
typeof(PopupAssist),
|
||||
new PropertyMetadata(false, OnSimulateNativeBehaviorChanged)); // 【回调已更新】
|
||||
|
||||
public static void SetSimulateNativeBehavior(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(SimulateNativeBehaviorProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetSimulateNativeBehavior(DependencyObject element)
|
||||
{
|
||||
return (bool)element.GetValue(SimulateNativeBehaviorProperty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private State Management Properties
|
||||
|
||||
private static readonly DependencyProperty PreviewMouseDownHandlerProperty =
|
||||
DependencyProperty.RegisterAttached("PreviewMouseDownHandler", typeof(MouseButtonEventHandler), typeof(PopupAssist));
|
||||
|
||||
private static readonly DependencyProperty WindowEventHandlerProperty =
|
||||
DependencyProperty.RegisterAttached("WindowEventHandler", typeof(EventHandler), typeof(PopupAssist));
|
||||
|
||||
private static readonly DependencyProperty PreviewMouseWheelHandlerProperty =
|
||||
DependencyProperty.RegisterAttached("PreviewMouseWheelHandler", typeof(MouseWheelEventHandler), typeof(PopupAssist));
|
||||
|
||||
#endregion
|
||||
|
||||
// 【回调已更新】
|
||||
private static void OnSimulateNativeBehaviorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (!(d is Popup popup)) return;
|
||||
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
popup.Opened += OnPopupOpened;
|
||||
}
|
||||
else
|
||||
{
|
||||
popup.Opened -= OnPopupOpened;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnPopupOpened(object sender, EventArgs e)
|
||||
{
|
||||
var popup = sender as Popup;
|
||||
if (popup == null) return;
|
||||
|
||||
var window = Window.GetWindow(popup);
|
||||
if (window == null) return;
|
||||
|
||||
// --- 自动关闭逻辑 ---
|
||||
EventHandler windowEventHandler = (s, args) =>
|
||||
{
|
||||
popup.Dispatcher.BeginInvoke(new Action(() => {
|
||||
popup.IsOpen = false;
|
||||
}));
|
||||
};
|
||||
popup.SetValue(WindowEventHandlerProperty, windowEventHandler);
|
||||
window.Deactivated += windowEventHandler;
|
||||
window.LocationChanged += windowEventHandler;
|
||||
|
||||
MouseButtonEventHandler mouseDownHandler = (s, args) =>
|
||||
{
|
||||
if (popup.IsMouseOver || (popup.PlacementTarget != null && popup.PlacementTarget.IsMouseOver))
|
||||
{
|
||||
return;
|
||||
}
|
||||
popup.IsOpen = false;
|
||||
};
|
||||
popup.SetValue(PreviewMouseDownHandlerProperty, mouseDownHandler);
|
||||
window.AddHandler(UIElement.PreviewMouseDownEvent, mouseDownHandler, true);
|
||||
|
||||
// --- 鼠标滚轮拦截逻辑 ---
|
||||
MouseWheelEventHandler mouseWheelHandler = (s, args) =>
|
||||
{
|
||||
if (!popup.IsMouseOver)
|
||||
{
|
||||
args.Handled = true;
|
||||
}
|
||||
};
|
||||
popup.SetValue(PreviewMouseWheelHandlerProperty, mouseWheelHandler);
|
||||
window.AddHandler(UIElement.PreviewMouseWheelEvent, mouseWheelHandler, true);
|
||||
|
||||
popup.Closed += OnPopupClosed;
|
||||
}
|
||||
|
||||
private static void OnPopupClosed(object sender, EventArgs e)
|
||||
{
|
||||
var popup = sender as Popup;
|
||||
if (popup == null) return;
|
||||
|
||||
popup.Closed -= OnPopupClosed;
|
||||
|
||||
var window = Window.GetWindow(popup);
|
||||
if (window == null) return;
|
||||
|
||||
if (popup.GetValue(WindowEventHandlerProperty) is EventHandler windowEventHandler)
|
||||
{
|
||||
window.Deactivated -= windowEventHandler;
|
||||
window.LocationChanged -= windowEventHandler;
|
||||
popup.ClearValue(WindowEventHandlerProperty);
|
||||
}
|
||||
|
||||
if (popup.GetValue(PreviewMouseDownHandlerProperty) is MouseButtonEventHandler mouseDownHandler)
|
||||
{
|
||||
window.RemoveHandler(UIElement.PreviewMouseDownEvent, mouseDownHandler);
|
||||
popup.ClearValue(PreviewMouseDownHandlerProperty);
|
||||
}
|
||||
|
||||
if (popup.GetValue(PreviewMouseWheelHandlerProperty) is MouseWheelEventHandler mouseWheelHandler)
|
||||
{
|
||||
window.RemoveHandler(UIElement.PreviewMouseWheelEvent, mouseWheelHandler);
|
||||
popup.ClearValue(PreviewMouseWheelHandlerProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
|
||||
<Style TargetType="{x:Type local:AccordionItem}">
|
||||
<Style TargetType="{x:Type controls:AccordionItem}">
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:AccordionItem}">
|
||||
<ControlTemplate TargetType="{x:Type controls:AccordionItem}">
|
||||
<Border
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
@@ -136,7 +136,7 @@
|
||||
</Style>
|
||||
|
||||
<!-- Accordion Style (无改动) -->
|
||||
<Style TargetType="{x:Type local:Accordion}">
|
||||
<Style TargetType="{x:Type controls:Accordion}">
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
@@ -146,7 +146,7 @@
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:Accordion}">
|
||||
<ControlTemplate TargetType="{x:Type controls:Accordion}">
|
||||
<decorations:EmbossBorder
|
||||
Background="{DynamicResource ControlBackgroundNormalBrush}"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
|
||||
94
NeoUI/NeoUI/Controls/AdornerPopup.cs
Normal file
94
NeoUI/NeoUI/Controls/AdornerPopup.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,18 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type local:AutoComplete}">
|
||||
<!--<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="FlattenTextBox.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>-->
|
||||
|
||||
<Style TargetType="{x:Type controls:AutoComplete}">
|
||||
<Setter Property="assists:InputAssist.Placeholder" Value="请输入..." />
|
||||
<Setter Property="assists:InputAssist.Clearable" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:AutoComplete}">
|
||||
<ControlTemplate TargetType="{x:Type controls:AutoComplete}">
|
||||
<Grid>
|
||||
<TextBox
|
||||
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
|
||||
@@ -24,7 +27,8 @@
|
||||
MinWidth="{Binding ActualWidth, ElementName=PART_TextBox}"
|
||||
PlacementTarget="{Binding ElementName=PART_TextBox}"
|
||||
PopupAnimation="Slide"
|
||||
StaysOpen="False"
|
||||
assists:PopupAssist.SimulateNativeBehavior="True"
|
||||
StaysOpen="True"
|
||||
x:Name="PART_Popup">
|
||||
<Border
|
||||
Background="{DynamicResource BackgroundFloatingBrush}"
|
||||
@@ -80,7 +84,7 @@
|
||||
<ContentPresenter.Content>
|
||||
<MultiBinding Converter="{x:Static converters:StringMatchConverter.Instance}">
|
||||
<Binding />
|
||||
<Binding Path="Text" RelativeSource="{RelativeSource AncestorType=local:AutoComplete}" />
|
||||
<Binding Path="Text" RelativeSource="{RelativeSource AncestorType=controls:AutoComplete}" />
|
||||
</MultiBinding>
|
||||
</ContentPresenter.Content>
|
||||
</ContentPresenter>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -46,46 +46,7 @@
|
||||
To="0.4"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
<!--<Style x:Key="DefaultCascaderListBoxItemStyle" TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="4,2" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="true">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextInverseBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>-->
|
||||
|
||||
<Style x:Key="DefaultCascaderPanelStyle" TargetType="ListBox">
|
||||
<!--<Setter Property="ItemContainerStyle" Value="{DynamicResource DefaultCascaderListBoxItemStyle}" />-->
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
|
||||
@@ -119,7 +80,7 @@
|
||||
<!-- 第一个绑定:当前的数据项 -->
|
||||
<Binding Path="." />
|
||||
<!-- 第二个绑定:从祖先 Cascader 获取 DisplayMemberPath -->
|
||||
<Binding Path="DisplayMemberPath" RelativeSource="{RelativeSource AncestorType=local:Cascader}" />
|
||||
<Binding Path="DisplayMemberPath" RelativeSource="{RelativeSource AncestorType=controls:Cascader}" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
@@ -141,7 +102,7 @@
|
||||
<DataTrigger.Binding>
|
||||
<MultiBinding Converter="{x:Static internal:HasChildrenMultiConverter.Instance}">
|
||||
<Binding Path="." />
|
||||
<Binding Path="SubmenuMemberPath" RelativeSource="{RelativeSource AncestorType=local:Cascader}" />
|
||||
<Binding Path="SubmenuMemberPath" RelativeSource="{RelativeSource AncestorType=controls:Cascader}" />
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter TargetName="Arrow" Property="Visibility" Value="Visible" />
|
||||
@@ -181,7 +142,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type local:Cascader}">
|
||||
<Style TargetType="{x:Type controls:Cascader}">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
@@ -200,7 +161,7 @@
|
||||
<Setter Property="PanelStyle" Value="{StaticResource DefaultCascaderPanelStyle}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:Cascader}">
|
||||
<ControlTemplate TargetType="{x:Type controls:Cascader}">
|
||||
<!-- ... Grid 和 ToggleButton 保持不变 ... -->
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<ToggleButton
|
||||
@@ -233,7 +194,7 @@
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"
|
||||
Text="{Binding SelectedText, RelativeSource={RelativeSource AncestorType=local:Cascader}}"
|
||||
Text="{Binding SelectedText, RelativeSource={RelativeSource AncestorType=controls:Cascader}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Border
|
||||
x:Name="splitBorder"
|
||||
@@ -259,7 +220,7 @@
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"
|
||||
Text="{Binding SelectedText, RelativeSource={RelativeSource AncestorType=local:Cascader}}"
|
||||
Text="{Binding SelectedText, RelativeSource={RelativeSource AncestorType=controls:Cascader}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Path
|
||||
x:Name="arrow"
|
||||
@@ -311,12 +272,12 @@
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextPlaceholderBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Text="{Binding Path=(assists:SelectorAssist.Placeholder), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Cascader}}">
|
||||
Text="{Binding Path=(assists:SelectorAssist.Placeholder), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:Cascader}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SelectedText, RelativeSource={RelativeSource AncestorType=local:Cascader}}" Value="">
|
||||
<DataTrigger Binding="{Binding SelectedText, RelativeSource={RelativeSource AncestorType=controls:Cascader}}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
@@ -324,6 +285,7 @@
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<Popup
|
||||
assists:PopupAssist.SimulateNativeBehavior="True"
|
||||
x:Name="PART_Popup"
|
||||
Margin="-8"
|
||||
AllowsTransparency="True"
|
||||
@@ -331,12 +293,12 @@
|
||||
Placement="Bottom"
|
||||
PlacementTarget="{Binding ElementName=PART_ToggleButton}"
|
||||
PopupAnimation="Slide"
|
||||
StaysOpen="False">
|
||||
StaysOpen="True">
|
||||
<Border
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
||||
MaxHeight="300"
|
||||
Margin="8"
|
||||
Background="{DynamicResource BackgroundLayoutBrush}"
|
||||
Background="{DynamicResource BackgroundFloatingBrush}"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
@@ -383,7 +345,7 @@
|
||||
<Button
|
||||
Padding="4,2"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=local:Cascader}, Path=SelectSearchResultCommand}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType=controls:Cascader}, Path=SelectSearchResultCommand}"
|
||||
CommandParameter="{Binding}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace NeoUI.Controls;
|
||||
/// <summary>
|
||||
/// 用于实现级联选择器功能的控件类。该控件允许用户从多层级的数据源中选择一个值,通常应用于需要按类别或层级进行选择的场景。
|
||||
/// </summary>
|
||||
[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
|
||||
//[TemplatePart(Name = "PART_Popup", Type = typeof(Popup))]
|
||||
public class Cascader : Control
|
||||
{
|
||||
private static readonly DependencyPropertyKey FilteredItemsSourcePropertyKey = DependencyProperty.RegisterReadOnly("FilteredItemsSource", typeof(IEnumerable), typeof(Cascader), new PropertyMetadata(null));
|
||||
|
||||
@@ -417,12 +417,13 @@
|
||||
</ToggleButton>
|
||||
|
||||
<Popup
|
||||
assists:PopupAssist.SimulateNativeBehavior="True"
|
||||
AllowsTransparency="True"
|
||||
IsOpen="{Binding IsChecked, ElementName=PART_Trigger, Mode=TwoWay}"
|
||||
Placement="Bottom"
|
||||
PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
|
||||
PopupAnimation="None"
|
||||
StaysOpen="False"
|
||||
StaysOpen="True"
|
||||
x:Name="PART_Popup">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
|
||||
@@ -75,8 +75,9 @@
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Data="M 0,0 L 4,3 L 8,0"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
Stroke="{DynamicResource TextPrimaryBrush}"
|
||||
StrokeThickness="1" RenderTransformOrigin="0.5,0.5">
|
||||
StrokeThickness="1">
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform Angle="0" />
|
||||
</Path.RenderTransform>
|
||||
@@ -120,7 +121,65 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- 内容样式 -->
|
||||
<Style TargetType="{x:Type ComboBoxItem}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Padding" Value="12,4,8,4" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
||||
<Grid Margin="0,1">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
<!-- 选中标记 -->
|
||||
<Border
|
||||
x:Name="box"
|
||||
CornerRadius="4"
|
||||
Visibility="Hidden">
|
||||
<Border
|
||||
Width="4"
|
||||
Margin="2,4"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="2" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="box" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||||
</Trigger>
|
||||
<!--<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>-->
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- 可编辑模板 -->
|
||||
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="True">
|
||||
@@ -142,7 +201,7 @@
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="8"
|
||||
Background="{DynamicResource BackgroundLayoutBrush}"
|
||||
Background="{DynamicResource BackgroundFloatingBrush}"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
@@ -179,7 +238,7 @@
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Style="{StaticResource ComboBoxToggleButton}" />
|
||||
|
||||
<!-- 输入框 -->
|
||||
<Border
|
||||
x:Name="border"
|
||||
Grid.Column="0"
|
||||
@@ -193,6 +252,7 @@
|
||||
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Style="{StaticResource FlattenTextBox}" />
|
||||
</Border>
|
||||
<!-- 水印 -->
|
||||
<TextBlock
|
||||
x:Name="Placeholder"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
@@ -259,7 +319,7 @@
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="8"
|
||||
Background="{DynamicResource BackgroundLayoutBrush}"
|
||||
Background="{DynamicResource BackgroundFloatingBrush}"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
@@ -371,68 +431,10 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- 默认下拉样式 -->
|
||||
<Style BasedOn="{StaticResource ComboBoxDefault}" TargetType="{x:Type ComboBox}" />
|
||||
|
||||
<!-- 内容样式 -->
|
||||
<Style TargetType="{x:Type ComboBoxItem}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Padding" Value="12,4,8,4" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
||||
<Grid Margin="0,1">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
<!-- 选中标记 -->
|
||||
<Border
|
||||
x:Name="box"
|
||||
CornerRadius="4"
|
||||
Visibility="Hidden">
|
||||
<Border
|
||||
Width="4"
|
||||
Margin="2,4"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="2" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="box" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 工具栏下拉Toggle -->
|
||||
<Style x:Key="ToolbarComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
||||
@@ -465,9 +467,10 @@
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Data="M 0,0 L 4,4 L 0,8 Z"
|
||||
Fill="{DynamicResource TextPrimaryBrush}"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
Data="M 0,0 L 4,3 L 8,0"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
Stroke="{DynamicResource TextPrimaryBrush}"
|
||||
StrokeThickness="1">
|
||||
<Path.RenderTransform>
|
||||
<RotateTransform Angle="0" />
|
||||
</Path.RenderTransform>
|
||||
@@ -480,7 +483,7 @@
|
||||
</Trigger>
|
||||
<!-- 下压效果 -->
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryPressedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
@@ -521,7 +524,7 @@
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
Margin="8"
|
||||
Background="{DynamicResource BackgroundContainerBrush}"
|
||||
Background="{DynamicResource BackgroundFloatingBrush}"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
|
||||
56
NeoUI/NeoUI/Controls/ContentAdorner.cs
Normal file
56
NeoUI/NeoUI/Controls/ContentAdorner.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:sve="clr-namespace:NeoUI.Effects"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="CalendarStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
@@ -37,7 +38,7 @@
|
||||
</ControlTemplate.Resources>
|
||||
<Grid>
|
||||
<Grid>
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -54,7 +55,7 @@
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="PART_Watermark" />
|
||||
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
<ScrollViewer
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
@@ -226,10 +227,11 @@
|
||||
Opacity="0"
|
||||
x:Name="DisabledMask" />
|
||||
<Popup
|
||||
assists:PopupAssist.SimulateNativeBehavior="True"
|
||||
AllowsTransparency="True"
|
||||
Placement="Bottom"
|
||||
PlacementTarget="{Binding ElementName=PART_Button}"
|
||||
StaysOpen="False"
|
||||
StaysOpen="True"
|
||||
x:Name="PART_Popup" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:cvt="clr-namespace:NeoUI.Converters"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type svd:EmbossBorder}">
|
||||
<Style TargetType="{x:Type decorations:EmbossBorder}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="CornerRadius" Value="4" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type svd:EmbossBorder}">
|
||||
<ControlTemplate TargetType="{x:Type decorations:EmbossBorder}">
|
||||
<Grid>
|
||||
<!-- 光影区域 -->
|
||||
<!-- 默认4的边距显示光影效果 -->
|
||||
|
||||
@@ -10,14 +10,14 @@ namespace NeoUI.Controls.Decorations;
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code>
|
||||
/// <local:GlassChromeDecorator Width="180" Height="220"
|
||||
/// <controls:GlassChromeDecorator Width="180" Height="220"
|
||||
/// HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
||||
/// Margin="50"
|
||||
/// CornerRadius="10"
|
||||
/// Background="#40FF0000">
|
||||
/// <!-- 半透明红色背景 -->
|
||||
/// <TextBlock Text = "Mini Card" Foreground="White" FontSize="16"/>
|
||||
///</local:GlassChromeDecorator>
|
||||
///</controls:GlassChromeDecorator>
|
||||
/// </code>
|
||||
/// <![CDATA[]]>
|
||||
/// </example>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type svd:LightedSurface}">
|
||||
<Style TargetType="{x:Type decorations:LightedSurface}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="LightColorBrush" Value="#FF111319" />
|
||||
<Setter Property="LightSize" Value="200" />
|
||||
@@ -15,7 +15,7 @@
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type svd:LightedSurface}">
|
||||
<ControlTemplate TargetType="{x:Type decorations:LightedSurface}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="ShowLight">
|
||||
<DoubleAnimation
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style TargetType="{x:Type local:Divider}">
|
||||
<Style TargetType="{x:Type controls:Divider}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource DividerBrush}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:Divider}">
|
||||
<ControlTemplate TargetType="{x:Type controls:Divider}">
|
||||
<Grid>
|
||||
<!-- 唯一的水平布局容器,智能且优雅 -->
|
||||
<Grid x:Name="HorizontalLayout">
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<!-- TODO:禁用效果 -->
|
||||
<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">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Assets/CommonGeometry.xaml" />
|
||||
@@ -236,7 +236,7 @@
|
||||
PlacementTarget="{Binding ElementName=templateRoot}"
|
||||
PopupAnimation="Fade"
|
||||
x:Name="PART_Popup">
|
||||
<svd:LightedSurface
|
||||
<decorations:LightedSurface
|
||||
BorderBrush="{DynamicResource BorderGradientBrush}"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource PopupShadow}"
|
||||
@@ -265,7 +265,7 @@
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</svd:LightedSurface>
|
||||
</decorations:LightedSurface>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -476,7 +476,7 @@
|
||||
PopupAnimation="Fade"
|
||||
VerticalOffset="-3"
|
||||
x:Name="PART_Popup">
|
||||
<svd:LightedSurface
|
||||
<decorations:LightedSurface
|
||||
BorderBrush="{DynamicResource BorderGradientBrush}"
|
||||
BorderThickness="1"
|
||||
Effect="{DynamicResource PopupShadow}"
|
||||
@@ -505,7 +505,7 @@
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</svd:LightedSurface>
|
||||
</decorations:LightedSurface>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
x:Class="NeoUI.Controls.ModalWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Window.Resources>
|
||||
|
||||
@@ -268,11 +268,11 @@
|
||||
<!--#endregion-->
|
||||
</Grid>
|
||||
<Popup
|
||||
assists:PopupAssist.SimulateNativeBehavior="True"
|
||||
x:Name="dropDownBorder"
|
||||
MinWidth="{Binding ActualWidth, ElementName=ToggleButton}"
|
||||
Margin="-8"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Placement="Bottom"
|
||||
PopupAnimation="Slide"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -37,7 +37,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>-->
|
||||
|
||||
<Style TargetType="{x:Type local:NumberBox}">
|
||||
<Style TargetType="{x:Type controls:NumberBox}">
|
||||
<!--<Setter Property="BorderThickness" Value="1"/>-->
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Padding" Value="2" />
|
||||
@@ -47,7 +47,7 @@
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:NumberBox}">
|
||||
<ControlTemplate TargetType="{x:Type controls:NumberBox}">
|
||||
<decorations:SlotBorder
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<MultiBinding Converter="{x:Static converters:ComparisionConverter.Instance}">
|
||||
<Binding Path="Value" />
|
||||
<!-- 来自按钮的 DataContext (PageItem.Value) -->
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=local:PaginationControl}" />
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=controls:PaginationControl}" />
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter Property="Visibility" TargetName="emboss" Value="Collapsed" />
|
||||
@@ -67,7 +67,7 @@
|
||||
<MultiBinding Converter="{x:Static converters:ComparisionConverter.Instance}">
|
||||
<Binding Path="Value" />
|
||||
<!-- 来自按钮的 DataContext (PageItem.Value) -->
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=local:PaginationControl}" />
|
||||
<Binding Path="CurrentPage" RelativeSource="{RelativeSource AncestorType=controls:PaginationControl}" />
|
||||
</MultiBinding>
|
||||
</DataTrigger.Binding>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
@@ -89,10 +89,10 @@
|
||||
</Style>
|
||||
|
||||
<!-- PaginationControl 的主模板 -->
|
||||
<Style TargetType="{x:Type local:PaginationControl}">
|
||||
<Style TargetType="{x:Type controls:PaginationControl}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:PaginationControl}">
|
||||
<ControlTemplate TargetType="{x:Type controls:PaginationControl}">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<!-- 页码按钮列表 -->
|
||||
<ItemsControl ItemsSource="{Binding PageItems, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
@@ -102,7 +102,7 @@
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type local:PageItem}">
|
||||
<DataTemplate DataType="{x:Type controls:PageItem}">
|
||||
<Button
|
||||
Content="{Binding Text}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations">
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations">
|
||||
|
||||
<!--<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/NeuWPF;component/Controls/TextBoxStyle.xaml" />
|
||||
@@ -31,7 +31,7 @@
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
@@ -45,7 +45,7 @@
|
||||
Focusable="false"
|
||||
HorizontalScrollBarVisibility="Hidden"
|
||||
VerticalScrollBarVisibility="Hidden" />
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiTrigger>
|
||||
@@ -99,7 +99,7 @@
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid>
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
x:Name="slot"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
@@ -226,7 +226,7 @@
|
||||
</ToggleButton>
|
||||
|
||||
</Grid>
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ControlTemplate TargetType="{x:Type ProgressBar}" x:Key="ProgressHorizontalDefault">
|
||||
@@ -13,7 +13,7 @@
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -39,7 +39,7 @@
|
||||
<Binding
|
||||
Mode="OneWay"
|
||||
Path="ActualWidth"
|
||||
RelativeSource="{RelativeSource AncestorType={x:Type svd:SlotBorder}}" />
|
||||
RelativeSource="{RelativeSource AncestorType={x:Type decorations:SlotBorder}}" />
|
||||
</MultiBinding>
|
||||
</Grid.Width>
|
||||
<!-- 背景模糊效果 -->
|
||||
@@ -58,7 +58,7 @@
|
||||
x:Name="borderProgress" />
|
||||
</Grid>
|
||||
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsIndeterminate" Value="True">
|
||||
<Setter Property="Width" TargetName="BarGrid" Value="auto" />
|
||||
@@ -103,7 +103,7 @@
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -129,7 +129,7 @@
|
||||
<Binding
|
||||
Mode="OneWay"
|
||||
Path="ActualHeight"
|
||||
RelativeSource="{RelativeSource AncestorType={x:Type svd:SlotBorder}}" />
|
||||
RelativeSource="{RelativeSource AncestorType={x:Type decorations:SlotBorder}}" />
|
||||
</MultiBinding>
|
||||
</Grid.Height>
|
||||
<!-- 背景模糊效果 -->
|
||||
@@ -141,7 +141,7 @@
|
||||
<!-- 进度条 -->
|
||||
<Border Background="{TemplateBinding Foreground}" CornerRadius="3" />
|
||||
</Grid>
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsIndeterminate" Value="True">
|
||||
<Setter Property="Height" TargetName="BarGrid" Value="auto" />
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
|
||||
<Rectangle
|
||||
Fill="{DynamicResource ControlStrongBackgroundBrush}"
|
||||
Fill="{DynamicResource TextSecondaryBrush}"
|
||||
Height="{TemplateBinding Height}"
|
||||
Margin="6,1,1,1"
|
||||
RadiusX="1.5"
|
||||
@@ -183,7 +183,7 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Rectangle
|
||||
Fill="{DynamicResource ControlStrongBackgroundBrush}"
|
||||
Fill="{DynamicResource TextSecondaryBrush}"
|
||||
Height="{TemplateBinding Height}"
|
||||
Margin="1,6,1,1"
|
||||
RadiusX="1.5"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
x:Class="NeoUI.Controls.SplashWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Window.Resources>
|
||||
@@ -87,7 +87,7 @@
|
||||
</Window.Triggers>
|
||||
<Grid>
|
||||
<Viewbox
|
||||
Height="{x:Static local:SplashConfig.ImageHeight}"
|
||||
Height="{x:Static controls:SplashConfig.ImageHeight}"
|
||||
HorizontalAlignment="Center"
|
||||
Name="viewbox"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
@@ -101,9 +101,9 @@
|
||||
</TransformGroup>
|
||||
</UIElement.RenderTransform>
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<local:Border ClipToBounds="True" CornerRadius="{x:Static local:SplashConfig.CornerRadius}">
|
||||
<controls:Border ClipToBounds="True" CornerRadius="{x:Static controls:SplashConfig.CornerRadius}">
|
||||
<Image Source="{Binding ImageUri}" />
|
||||
</local:Border>
|
||||
</controls:Border>
|
||||
</Grid>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
|
||||
@@ -102,18 +102,14 @@
|
||||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
|
||||
<!-- 关闭图标 -->
|
||||
<Viewbox
|
||||
<!-- 关闭图标 为了让触发Close范围足够大而不是只有Path的才能触发,套了一层Border-->
|
||||
<Border
|
||||
x:Name="PART_Close"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Focusable="False"
|
||||
SnapsToDevicePixels="True"
|
||||
Stretch="Uniform"
|
||||
UseLayoutRounding="True"
|
||||
Background="Transparent"
|
||||
Visibility="Collapsed">
|
||||
<Viewbox.Style>
|
||||
<Style TargetType="{x:Type Viewbox}">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="Opacity" Value="0.65" />
|
||||
<Setter Property="Margin" Value="2,0,0,0" />
|
||||
<Style.Triggers>
|
||||
@@ -123,9 +119,17 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Viewbox.Style>
|
||||
<Path Data="F1 M1024,1024z M0,0z M578.36284173,512L1000.67183457,89.69100716C1018.7707914,71.59205033 1018.7707914,41.42712226 1000.67183457,23.32816543 982.57287774,5.22920860000003 952.40794967,5.22920860000003 934.30899284,23.32816543L512,445.63715827 89.69100716,23.32816543C71.59205033,5.22920860000001 41.42712226,5.22920860000001 23.32816543,23.32816543 5.22920860000003,41.42712226 5.22920860000003,71.59205033 23.32816543,89.69100716L445.63715827,512 23.32816543,934.30899284C5.22920860000001,952.40794967 5.22920860000001,982.57287774 23.32816543,1000.67183457 41.42712226,1018.7707914 71.59205033,1018.7707914 89.69100716,1000.67183457L512,578.36284173 934.30899284,1000.67183457C952.40794967,1018.7707914 982.57287774,1018.7707914 1000.67183457,1000.67183457 1018.7707914,982.57287774 1018.7707914,952.40794967 1000.67183457,934.30899284L578.36284173,512z" Fill="{TemplateBinding Foreground}" />
|
||||
</Viewbox>
|
||||
</Border.Style>
|
||||
<Viewbox
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Focusable="False"
|
||||
SnapsToDevicePixels="True"
|
||||
Stretch="Uniform"
|
||||
UseLayoutRounding="True">
|
||||
|
||||
<Path Data="F1 M1024,1024z M0,0z M578.36284173,512L1000.67183457,89.69100716C1018.7707914,71.59205033 1018.7707914,41.42712226 1000.67183457,23.32816543 982.57287774,5.22920860000003 952.40794967,5.22920860000003 934.30899284,23.32816543L512,445.63715827 89.69100716,23.32816543C71.59205033,5.22920860000001 41.42712226,5.22920860000001 23.32816543,23.32816543 5.22920860000003,41.42712226 5.22920860000003,71.59205033 23.32816543,89.69100716L445.63715827,512 23.32816543,934.30899284C5.22920860000001,952.40794967 5.22920860000001,982.57287774 23.32816543,1000.67183457 41.42712226,1018.7707914 71.59205033,1018.7707914 89.69100716,1000.67183457L512,578.36284173 934.30899284,1000.67183457C952.40794967,1018.7707914 982.57287774,1018.7707914 1000.67183457,1000.67183457 1018.7707914,982.57287774 1018.7707914,952.40794967 1000.67183457,934.30899284L578.36284173,512z" Fill="{TemplateBinding Foreground}" />
|
||||
</Viewbox>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/NeoUI;component/Controls/IconElement.xaml" />
|
||||
@@ -77,7 +77,7 @@
|
||||
</ControlTemplate.Resources>
|
||||
|
||||
<Grid>
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -85,7 +85,7 @@
|
||||
Margin="-4"
|
||||
SnapsToDevicePixels="True"
|
||||
x:Name="slot" />
|
||||
<svd:EmbossBorder
|
||||
<decorations:EmbossBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -270,7 +270,7 @@
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -336,7 +336,7 @@
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="Suffix" />
|
||||
</Grid>
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Text, Mode=OneWay, RelativeSource={RelativeSource Self}}" Value="">
|
||||
@@ -462,7 +462,7 @@
|
||||
To="0.2" />
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@@ -479,7 +479,7 @@
|
||||
IsTabStop="False"
|
||||
VerticalScrollBarVisibility="Hidden"
|
||||
x:Name="PART_ContentHost" />
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Width="320"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:assist="clr-namespace:NeoUI.Assists"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:internal="clr-namespace:NeoUI.Converters.Internal"
|
||||
xmlns:svd="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:decorations="clr-namespace:NeoUI.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="{x:Type ToggleButton}" x:Key="NeuToggleSwitch">
|
||||
@@ -38,7 +38,7 @@
|
||||
Visibility="Collapsed"
|
||||
x:Name="AnimationProxy" />
|
||||
<!-- 背景层 -->
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{Binding Path=ActualHeight, ElementName=SwitchContainer, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Intensity="0.3"
|
||||
@@ -97,7 +97,7 @@
|
||||
</TranslateTransform.X>
|
||||
</TranslateTransform>
|
||||
</Grid.RenderTransform>
|
||||
<svd:EmbossBorder
|
||||
<decorations:EmbossBorder
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="{Binding Path=ActualHeight, ElementName=SwitchContainer, Converter={x:Static converters:DivideByTwoConverter.Instance}}"
|
||||
Intensity="0.5"
|
||||
@@ -105,7 +105,7 @@
|
||||
Padding="0"
|
||||
x:Name="circle">
|
||||
<!--<Ellipse x:Name="optionMark" Fill="{DynamicResource PrimaryNormalBrush}" />-->
|
||||
</svd:EmbossBorder>
|
||||
</decorations:EmbossBorder>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
@@ -208,13 +208,13 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid>
|
||||
<svd:EmbossBorder
|
||||
<decorations:EmbossBorder
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Intensity="0.6"
|
||||
Margin="0"
|
||||
ShaderEnabled="True"
|
||||
x:Name="border" />
|
||||
<svd:SlotBorder
|
||||
<decorations:SlotBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
Intensity="0"
|
||||
Margin="0"
|
||||
@@ -228,7 +228,7 @@
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="contentPresenter" />
|
||||
</svd:SlotBorder>
|
||||
</decorations:SlotBorder>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
@@ -459,8 +459,7 @@
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource TextInverseBrush}" />
|
||||
<Setter Property="Background" TargetName="border" Value="{DynamicResource ControlBackgroundPressedBrush}" />
|
||||
<Setter Property="Background" TargetName="border" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Button.IsDefaulted" Value="True" />
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||||
xmlns:local="clr-namespace:NeoUI.Controls"
|
||||
xmlns:controls="clr-namespace:NeoUI.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Style TargetType="Button" x:Key="DeleteButtonStyle">
|
||||
@@ -30,15 +30,15 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type local:UploadArea}">
|
||||
<Style TargetType="{x:Type controls:UploadArea}">
|
||||
<Setter Property="AllowDrop" Value="True" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="8" />
|
||||
<!--<Setter Property="Padding" Value="8" />-->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:UploadArea}">
|
||||
<ControlTemplate TargetType="{x:Type controls:UploadArea}">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<!-- 上传区域 -->
|
||||
@@ -54,13 +54,11 @@
|
||||
<Border
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="2"
|
||||
CornerRadius="4"
|
||||
Padding="16"
|
||||
x:Name="DropAreaBorder">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<!--<Setter Property="BorderDashArray" Value="4 4"/>-->
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
@@ -93,7 +91,7 @@
|
||||
<!-- 已选文件列表 -->
|
||||
<ItemsControl ItemsSource="{TemplateBinding FileList}" Margin="0,8,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type local:UploadFileItem}">
|
||||
<DataTemplate DataType="{x:Type controls:UploadFileItem}">
|
||||
<Border
|
||||
Background="{DynamicResource BackgroundLayoutBrush}"
|
||||
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||||
@@ -128,7 +126,7 @@
|
||||
VerticalAlignment="Center" />
|
||||
|
||||
<Button
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:UploadArea}}, Path=RemoveItemCommand}"
|
||||
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:UploadArea}}, Path=RemoveItemCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Grid.Column="2"
|
||||
Style="{StaticResource DeleteButtonStyle}" />
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace NeoUI.Markup
|
||||
/// <summary>
|
||||
/// 在ResourceDictionary中声明
|
||||
/// </summary>
|
||||
/// <example><c>local:EnumSourceExtension x:Key="EnumBindingSource" EnumType="{x:AppearanceType local:Sex}"</c></example>
|
||||
/// <example><c>ItemsSource="{local:EnumSource EnumType=local:ExampleEnum}" SelectedItem="{Binding ExampleEnum}"</c></example>
|
||||
/// <example><c>controls:EnumSourceExtension x:Key="EnumBindingSource" EnumType="{x:AppearanceType controls:Sex}"</c></example>
|
||||
/// <example><c>ItemsSource="{controls:EnumSource EnumType=controls:ExampleEnum}" SelectedItem="{Binding ExampleEnum}"</c></example>
|
||||
public EnumSourceExtension()
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace NeoUI.Markup
|
||||
/// </summary>
|
||||
/// <param name="enumType"></param>
|
||||
/// <remarks>若需要绑定Description,则需设置BindToDescription为True,同时只能用SelectedValue来绑定源属性</remarks>
|
||||
/// <example><c>ItemsSource="{Binding Source={local:EnumTypeBindingSource {x:AppearanceType local:ExampleEnum}}}"</c></example>
|
||||
/// <example><c>ItemsSource="{Binding Source={controls:EnumTypeBindingSource {x:AppearanceType controls:ExampleEnum}}}"</c></example>
|
||||
public EnumSourceExtension(Type enumType) { EnumType = enumType; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<Color x:Key="PrimaryFocusedColor">#82B1FF</Color>
|
||||
<SolidColorBrush x:Key="PrimaryFocusedBrush" Color="{DynamicResource PrimaryFocusedColor}" />
|
||||
|
||||
<Color x:Key="PrimaryDisabledColor">#B3C6FF</Color>
|
||||
<Color x:Key="PrimaryDisabledColor">#727EA3</Color>
|
||||
<SolidColorBrush x:Key="PrimaryDisabledBrush" Color="{DynamicResource PrimaryDisabledColor}" />
|
||||
|
||||
<!--
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
<Color x:Key="TextSecondaryColor">#6d7a7d</Color>
|
||||
<Color x:Key="TextDisabledColor">#767676</Color>
|
||||
<Color x:Key="TextInverseColor">#1C1E22</Color>
|
||||
<Color x:Key="TextPlaceholderColor">#595b60</Color>
|
||||
<Color x:Key="TextPlaceholderColor">#7B7E85</Color>
|
||||
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="{DynamicResource TextPrimaryColor}" />
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="{DynamicResource TextSecondaryColor}" />
|
||||
|
||||
@@ -574,22 +574,22 @@
|
||||
<n:ChooseBox Placeholder="请选择路径" />
|
||||
<n:ChooseBox IsEnabled="False" Text="选择路径" />
|
||||
</n:FlexibleRowPanel>
|
||||
<n:FlexibleRowPanel>
|
||||
<n:UploadArea
|
||||
<UniformGrid Rows="2" >
|
||||
<n:UploadArea Margin="5"
|
||||
Accept="Image Files|*.jpg;*.jpeg;*.png;*.gif|All Files|*.*"
|
||||
HintText="点击选择单个图片"
|
||||
Mode="FilesOnly" />
|
||||
<n:UploadArea HintText="点击选择一个项目文件夹" Mode="FoldersOnly" />
|
||||
<n:UploadArea
|
||||
<n:UploadArea Margin="5" HintText="点击选择一个项目文件夹" Mode="FoldersOnly" />
|
||||
<n:UploadArea Margin="5"
|
||||
Accept="Document Files|*.doc;*.docx;*.pdf|All Files|*.*"
|
||||
HintText="点击或拖拽多个文档到此"
|
||||
Mode="FilesOnly"
|
||||
Multiple="True" />
|
||||
<n:UploadArea
|
||||
<n:UploadArea Margin="5"
|
||||
HintText="点击或拖拽多个文件夹到此"
|
||||
Mode="FoldersOnly"
|
||||
Multiple="True" />
|
||||
</n:FlexibleRowPanel>
|
||||
</UniformGrid>
|
||||
</StackPanel>
|
||||
<StackPanel n:AnchorAssist.Header="下拉框 ComboBox">
|
||||
<n:FlexibleRowPanel Spacing="5">
|
||||
|
||||
Reference in New Issue
Block a user