17 files changed
+1309
-19
No files matched your search
@@ -832,6 +832,31 @@
|
||||
<tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" />
|
||||
<hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" />
|
||||
<hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" />
|
||||
<Geometry x:Key="NailGeometry">M956.553 366.486L657.514 67.447c-7.888-7.888-18.204-11.772-28.52-11.772s-20.632 3.884-28.52 11.772L404.958 263.085c-14.806-1.7-29.734-2.428-44.662-2.428-88.837 0-177.675 29.249-250.614 87.746-18.69 14.927-20.268 42.962-3.277 59.953l220.516 220.517L65.506 890.046c-3.156 3.155-5.219 7.403-5.583 11.893l-4.126 45.147c-1.093 11.408 8.01 21.117 19.296 21.117 0.607 0 1.214 0 1.82-0.121l45.148-4.126c4.49-0.364 8.738-2.428 11.893-5.583L395.37 696.957l220.517 220.517c7.888 7.888 18.204 11.772 28.52 11.772 11.772 0 23.423-5.097 31.433-15.05 68.327-85.317 96.726-192.117 85.197-295.397l195.516-195.515c15.655-15.535 15.655-41.021 0-56.798zM699.142 557.268l-29.734 29.734 4.612 41.75c4.49 40.898 1.213 81.555-9.952 120.998-6.554 23.059-15.535 45.026-26.943 65.779L208.593 386.753c15.655-8.616 31.918-15.898 48.909-21.724 33.01-11.408 67.599-17.112 102.794-17.112 11.651 0 23.423 0.607 35.074 1.942l41.75 4.612 29.733-29.734 162.262-162.262 232.41 232.41-162.383 162.383z</Geometry>
|
||||
<Geometry x:Key="DialogBoxLauncherGeometry">M0,0 8,0 8,1 1,1 1,8 0,8 M 3.7,3 8,7.3 8,4 9,4 9,9 4,9 4,8 7.3,8 3,3.7</Geometry>
|
||||
<Style TargetType="hc:RibbonTab">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTab">
|
||||
<hc:SimplePanel Visibility="Collapsed" x:Name="PART_RootContainer">
|
||||
<Border x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,3" Background="{TemplateBinding Background}" Margin="0" />
|
||||
<ScrollViewer hc:ScrollViewerAttach.Orientation="Horizontal" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
|
||||
<ItemsPresenter />
|
||||
</ScrollViewer>
|
||||
</hc:SimplePanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<SolidColorBrush o:Freeze="True" x:Key="LightPrimaryBrush" Color="{DynamicResource LightPrimaryColor}" />
|
||||
<LinearGradientBrush o:Freeze="True" x:Key="PrimaryBrush" EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop o:Freeze="True" Color="{DynamicResource PrimaryColor}" Offset="0" />
|
||||
@@ -7056,16 +7081,18 @@
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItem.Small}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight" Value="20" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight" Value="20" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,3" />
|
||||
<Setter Property="Padding" Value="6,0" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,0" />
|
||||
<Setter Property="Padding" Value="6,2,6,1" />
|
||||
<Setter Property="MinHeight" Value="20" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource ComboBoxPlusBaseStyle}" TargetType="hc:ComboBox" />
|
||||
<Style x:Key="ComboBoxPlus.Small" BasedOn="{StaticResource ComboBoxPlusBaseStyle}" TargetType="hc:ComboBox">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItem.Small}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight" Value="20" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight" Value="20" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,3" />
|
||||
<Setter Property="Padding" Value="6,0" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,0" />
|
||||
<Setter Property="Padding" Value="6,2,6,1" />
|
||||
<Setter Property="MinHeight" Value="20" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource WatermarkTextBoxBaseStyle}" TargetType="hc:WatermarkTextBox" />
|
||||
<Style BasedOn="{StaticResource TextBoxBaseStyle}" TargetType="TextBox" />
|
||||
@@ -10867,7 +10894,7 @@
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||
@@ -13335,6 +13362,132 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource RateBaseStyle}" TargetType="hc:Rate" />
|
||||
<Style TargetType="hc:RibbonGroup">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Height" Value="90" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
|
||||
<Setter Property="Padding" Value="6 6 6 0" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonGroup">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ItemsPresenter Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}" />
|
||||
<ContentPresenter Name="ContentPresenter" VerticalAlignment="Bottom" TextElement.Foreground="{DynamicResource SecondaryTextBrush}" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,2" ContentSource="Header" HorizontalAlignment="Center" Grid.Row="1" />
|
||||
<Button hc:Poptip.Instance="{TemplateBinding LauncherPoptip}" Command="interactivity:ControlCommands.More" Visibility="{Binding ShowLauncherButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,2,0" Grid.Column="1" Width="16" Height="16" Grid.Row="1" HorizontalAlignment="Right" Style="{StaticResource ButtonCustom}" hc:BackgroundSwitchElement.MouseHoverBackground="{DynamicResource SecondaryRegionBrush}">
|
||||
<Path Width="9" Height="9" Stretch="Uniform" Data="{StaticResource DialogBoxLauncherGeometry}" Fill="{DynamicResource SecondaryTextBrush}" />
|
||||
</Button>
|
||||
<Border Visibility="{Binding ShowSplitter,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,4" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Width="1" Background="{TemplateBinding BorderBrush}" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ShowLauncherButton" Value="True">
|
||||
<Setter TargetName="ContentPresenter" Property="Margin" Value="20,0,20,2" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="hc:RibbonTabHeader">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTabHeader">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<hc:SimplePanel x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Border x:Name="BorderBottom" Visibility="{Binding IsSelected,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,2" Margin="12,0,12,2" />
|
||||
<ContentPresenter x:Name="ContentPresenter" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" />
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="hc:Ribbon">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}" />
|
||||
<Setter Property="ContentHeight" Value="96" />
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
|
||||
<Setter Property="Padding" Value="10 0" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<hc:SimplePanel />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:Ribbon">
|
||||
<hc:ClipGrid x:Name="PART_RootPanel" IsClipEnabled="False">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Name="PART_ContentPanel" Grid.Row="1" Grid.ColumnSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Margin="{TemplateBinding Padding}" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" ShadowDepth="2" Direction="-90" Color="{StaticResource EffectShadowColor}" Opacity=".1" RenderingBias="Performance" />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<ItemsPresenter x:Name="PART_TabItemsPresenter" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.Column="0" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='1,0,0,0'}" />
|
||||
<ToggleButton Command="interactivity:ControlCommands.Switch" IsChecked="{Binding IsMinimized, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" Padding="2 0" Width="16" Height="20" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconElement.Geometry="{StaticResource UpGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource NailGeometry}" />
|
||||
</Grid>
|
||||
<ContentPresenter Grid.Row="0" Grid.Column="0" ContentSource="PrefixContent" />
|
||||
<hc:RibbonTabHeaderItemsControl Grid.Row="0" Grid.Column="1" Background="{TemplateBinding Background}" Focusable="False" x:Name="PART_TabHeaderItemsControl" Margin="0,0,0,2">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Margin="{Binding Padding, RelativeSource={RelativeSource AncestorType= hc:Ribbon}}" Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</hc:RibbonTabHeaderItemsControl>
|
||||
<ContentPresenter Grid.Row="0" Grid.Column="2" ContentSource="PostfixContent" />
|
||||
</hc:ClipGrid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource RunningBlockBaseStyle}" TargetType="hc:RunningBlock" />
|
||||
<Style BasedOn="{StaticResource SeparatorBaseStyle}" TargetType="Separator" />
|
||||
<Style BasedOn="{StaticResource ShieldBaseStyle}" TargetType="hc:Shield" />
|
||||
|
||||
@@ -4,8 +4,11 @@ using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Data.Enum;
|
||||
using HandyControl.Expression.Drawing;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace HandyControl.Controls;
|
||||
|
||||
@@ -13,6 +16,8 @@ public class Poptip : AdornerElement
|
||||
{
|
||||
private readonly Popup _popup;
|
||||
|
||||
private DispatcherTimer _openTimer;
|
||||
|
||||
public Poptip()
|
||||
{
|
||||
_popup = new Popup
|
||||
@@ -172,6 +177,15 @@ public class Poptip : AdornerElement
|
||||
set => SetValue(IsOpenProperty, ValueBoxes.BooleanBox(value));
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DelayProperty = DependencyProperty.Register(
|
||||
"Delay", typeof(double), typeof(Poptip), new PropertyMetadata(1000.0), ValidateHelper.IsInRangeOfPosDoubleIncludeZero);
|
||||
|
||||
public double Delay
|
||||
{
|
||||
get => (double) GetValue(DelayProperty);
|
||||
set => SetValue(DelayProperty, value);
|
||||
}
|
||||
|
||||
public static Poptip Default => new();
|
||||
|
||||
protected sealed override void OnTargetChanged(FrameworkElement element, bool isNew)
|
||||
@@ -290,8 +304,43 @@ public class Poptip : AdornerElement
|
||||
_popup.PlacementTarget = Target;
|
||||
UpdateLocation();
|
||||
}
|
||||
_popup.IsOpen = isShow;
|
||||
Target.SetCurrentValue(IsOpenProperty, isShow);
|
||||
|
||||
ResetTimer();
|
||||
|
||||
var delay = Delay;
|
||||
if (!isShow || HitMode != HitMode.Hover || MathHelper.IsVerySmall(delay))
|
||||
{
|
||||
|
||||
_popup.IsOpen = isShow;
|
||||
Target.SetCurrentValue(IsOpenProperty, isShow);
|
||||
}
|
||||
else
|
||||
{
|
||||
_openTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(delay)
|
||||
};
|
||||
|
||||
_openTimer.Tick += OpenTimer_Tick;
|
||||
_openTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetTimer()
|
||||
{
|
||||
if (_openTimer != null)
|
||||
{
|
||||
_openTimer.Stop();
|
||||
_openTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_popup.IsOpen = true;
|
||||
Target.SetCurrentValue(IsOpenProperty, true);
|
||||
|
||||
ResetTimer();
|
||||
}
|
||||
|
||||
private void Element_MouseEnter(object sender, MouseEventArgs e)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class ClipGrid : Grid
|
||||
{
|
||||
public static readonly DependencyProperty IsClipEnabledProperty = DependencyProperty.Register(
|
||||
"IsClipEnabled", typeof(bool), typeof(ClipGrid), new PropertyMetadata(ValueBoxes.TrueBox));
|
||||
|
||||
public bool IsClipEnabled
|
||||
{
|
||||
get => (bool) GetValue(IsClipEnabledProperty);
|
||||
set => SetValue(IsClipEnabledProperty, ValueBoxes.BooleanBox(value));
|
||||
}
|
||||
|
||||
protected override Geometry GetLayoutClip(Size layoutSlotSize)
|
||||
{
|
||||
if (IsClipEnabled)
|
||||
{
|
||||
return base.GetLayoutClip(layoutSlotSize);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,408 @@
|
||||
// some code fetch from system.windows.controls.ribbon.
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Interactivity;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
// TODO: this control is a work-in-progress, it needs to support things like automatic resizing.
|
||||
[TemplatePart(Name = TabHeaderItemsControl, Type = typeof(ItemsControl))]
|
||||
[TemplatePart(Name = RootPanel, Type = typeof(Panel))]
|
||||
[TemplatePart(Name = ContentPanel, Type = typeof(Panel))]
|
||||
public class Ribbon : Selector
|
||||
{
|
||||
private const string TabHeaderItemsControl = "PART_TabHeaderItemsControl";
|
||||
|
||||
private const string RootPanel = "PART_RootPanel";
|
||||
|
||||
private const string ContentPanel = "PART_ContentPanel";
|
||||
|
||||
private ItemsControl _tabHeaderItemsControl;
|
||||
|
||||
private Panel _rootPanel;
|
||||
|
||||
private Panel _contentPanel;
|
||||
|
||||
private System.Windows.Window _window;
|
||||
|
||||
private readonly ObservableCollection<object> _tabHeaderItemsSource = new();
|
||||
|
||||
internal ItemsControl RibbonTabHeaderItemsControl => _tabHeaderItemsControl;
|
||||
|
||||
public Ribbon()
|
||||
{
|
||||
SetRibbon(this, this);
|
||||
|
||||
Loaded += Ribbon_Loaded;
|
||||
Unloaded += Ribbon_Unloaded;
|
||||
|
||||
ItemContainerGenerator.StatusChanged += OnItemContainerGeneratorStatusChanged;
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Switch, IsMinimizedSwitchButton_OnClick));
|
||||
}
|
||||
|
||||
internal static readonly DependencyProperty RibbonProperty = DependencyProperty.RegisterAttached(
|
||||
"Ribbon", typeof(Ribbon), typeof(Ribbon),
|
||||
new FrameworkPropertyMetadata(default(Ribbon), FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
internal static void SetRibbon(DependencyObject element, Ribbon value)
|
||||
=> element.SetValue(RibbonProperty, value);
|
||||
|
||||
internal static Ribbon GetRibbon(DependencyObject element)
|
||||
=> (Ribbon) element.GetValue(RibbonProperty);
|
||||
|
||||
public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register(
|
||||
"IsDropDownOpen", typeof(bool), typeof(Ribbon), new PropertyMetadata(ValueBoxes.TrueBox, OnIsDropDownOpenChanged));
|
||||
|
||||
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((Ribbon) d).OnIsDropDownOpenChanged((bool) e.NewValue);
|
||||
}
|
||||
|
||||
private void OnIsDropDownOpenChanged(bool isDropDownOpen)
|
||||
{
|
||||
if (_contentPanel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SwitchCurrentTabContentVisibility(isDropDownOpen);
|
||||
_contentPanel.Show(isDropDownOpen);
|
||||
}
|
||||
|
||||
public bool IsDropDownOpen
|
||||
{
|
||||
get => (bool) GetValue(IsDropDownOpenProperty);
|
||||
set => SetValue(IsDropDownOpenProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsMinimizedProperty = DependencyProperty.Register(
|
||||
"IsMinimized", typeof(bool), typeof(Ribbon), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsMinimized
|
||||
{
|
||||
get => (bool) GetValue(IsMinimizedProperty);
|
||||
set => SetValue(IsMinimizedProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ContentHeightProperty = DependencyProperty.Register(
|
||||
"ContentHeight", typeof(double), typeof(Ribbon), new PropertyMetadata(default(double)));
|
||||
|
||||
public double ContentHeight
|
||||
{
|
||||
get => (double) GetValue(ContentHeightProperty);
|
||||
set => SetValue(ContentHeightProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PrefixContentProperty = DependencyProperty.Register(
|
||||
"PrefixContent", typeof(object), typeof(Ribbon), new PropertyMetadata(default(object)));
|
||||
|
||||
public object PrefixContent
|
||||
{
|
||||
get => GetValue(PrefixContentProperty);
|
||||
set => SetValue(PrefixContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PostfixContentProperty = DependencyProperty.Register(
|
||||
"PostfixContent", typeof(object), typeof(Ribbon), new PropertyMetadata(default(object)));
|
||||
|
||||
public object PostfixContent
|
||||
{
|
||||
get => GetValue(PostfixContentProperty);
|
||||
set => SetValue(PostfixContentProperty, value);
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
_tabHeaderItemsControl = GetTemplateChild(TabHeaderItemsControl) as ItemsControl;
|
||||
if (_tabHeaderItemsControl is {ItemsSource: null})
|
||||
{
|
||||
_tabHeaderItemsControl.ItemsSource = _tabHeaderItemsSource;
|
||||
}
|
||||
|
||||
_rootPanel = GetTemplateChild(RootPanel) as Panel;
|
||||
_contentPanel = GetTemplateChild(ContentPanel) as Panel;
|
||||
|
||||
if (IsMinimized)
|
||||
{
|
||||
_rootPanel.SetCurrentValue(HeightProperty, _tabHeaderItemsControl.ActualHeight);
|
||||
}
|
||||
|
||||
if (!IsDropDownOpen)
|
||||
{
|
||||
_contentPanel.SetCurrentValue(HeightProperty, .0);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ResetSelection()
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
InitializeSelection();
|
||||
}
|
||||
|
||||
internal void NotifyMouseClickedOnTabHeader(RibbonTabHeader tabHeader, MouseButtonEventArgs e)
|
||||
{
|
||||
if (_tabHeaderItemsControl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedIndex = _tabHeaderItemsControl.ItemContainerGenerator.IndexFromContainer(tabHeader);
|
||||
|
||||
if (e.ClickCount == 1)
|
||||
{
|
||||
var currentSelectedIndex = SelectedIndex;
|
||||
|
||||
if (currentSelectedIndex < 0 || currentSelectedIndex != selectedIndex)
|
||||
{
|
||||
SelectedIndex = selectedIndex;
|
||||
|
||||
if (IsMinimized)
|
||||
{
|
||||
IsDropDownOpen = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsMinimized)
|
||||
{
|
||||
IsDropDownOpen = !IsDropDownOpen;
|
||||
if (!IsDropDownOpen)
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (e.ClickCount == 2)
|
||||
{
|
||||
IsMinimized = !IsMinimized;
|
||||
IsDropDownOpen = !IsMinimized;
|
||||
|
||||
if (IsMinimized && !IsDropDownOpen)
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedIndex = selectedIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void NotifyTabHeaderChanged()
|
||||
{
|
||||
if (ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshHeaderCollection();
|
||||
}
|
||||
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
base.OnItemsChanged(e);
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Remove ||
|
||||
e.Action == NotifyCollectionChangedAction.Replace ||
|
||||
e.Action == NotifyCollectionChangedAction.Reset)
|
||||
{
|
||||
InitializeSelection();
|
||||
}
|
||||
|
||||
if ((ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated ||
|
||||
e.Action != NotifyCollectionChangedAction.Move) && e.Action != NotifyCollectionChangedAction.Remove)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RefreshHeaderCollection();
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RibbonTab();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RibbonTab;
|
||||
|
||||
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
|
||||
{
|
||||
base.OnSelectionChanged(e);
|
||||
|
||||
if (e.AddedItems is not {Count: > 0})
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SelectedItem = e.AddedItems[0];
|
||||
}
|
||||
|
||||
private void OnPreviewMouseButton(MouseButtonEventArgs e)
|
||||
{
|
||||
var postion = e.GetPosition(this);
|
||||
if (InputHitTest(postion) == null)
|
||||
{
|
||||
if (IsMinimized && IsDropDownOpen)
|
||||
{
|
||||
IsDropDownOpen = false;
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Ribbon_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_window = System.Windows.Window.GetWindow(this);
|
||||
if (_window != null)
|
||||
{
|
||||
_window.Deactivated += Window_Deactivated;
|
||||
_window.PreviewMouseLeftButtonDown += Window_PreviewMouseLeftButtonDown;
|
||||
_window.PreviewMouseLeftButtonUp += Window_PreviewMouseLeftButtonUp;
|
||||
_window.PreviewMouseRightButtonDown += Window_PreviewMouseRightButtonDown;
|
||||
_window.PreviewMouseRightButtonUp += Window_PreviewMouseRightButtonUp;
|
||||
}
|
||||
}
|
||||
|
||||
private void Ribbon_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_window != null)
|
||||
{
|
||||
_window.Deactivated -= Window_Deactivated;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) => OnPreviewMouseButton(e);
|
||||
|
||||
private void Window_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => OnPreviewMouseButton(e);
|
||||
|
||||
private void Window_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) => OnPreviewMouseButton(e);
|
||||
|
||||
private void Window_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e) => OnPreviewMouseButton(e);
|
||||
|
||||
private void Window_Deactivated(object sender, EventArgs e)
|
||||
{
|
||||
if (IsMinimized && IsDropDownOpen)
|
||||
{
|
||||
IsDropDownOpen = false;
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void IsMinimizedSwitchButton_OnClick(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
IsDropDownOpen = !IsMinimized;
|
||||
if (!IsDropDownOpen)
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemContainerGeneratorStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeSelection();
|
||||
RefreshHeaderCollection();
|
||||
}
|
||||
|
||||
private int GetFirstVisibleTabIndex()
|
||||
{
|
||||
var count = Items.Count;
|
||||
for (var index = 0; index < count; ++index)
|
||||
{
|
||||
if (ItemContainerGenerator.ContainerFromIndex(index) is RibbonTab {IsVisible: true})
|
||||
{
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void SwitchCurrentTabContentVisibility(bool isVisible)
|
||||
{
|
||||
var tab = GetCurrentTab();
|
||||
tab?.SwitchContentVisibility(isVisible);
|
||||
}
|
||||
|
||||
private RibbonTab GetCurrentTab()
|
||||
{
|
||||
var index = SelectedIndex;
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ItemContainerGenerator.ContainerFromIndex(index) is RibbonTab ribbonTab)
|
||||
{
|
||||
return ribbonTab;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void InitializeSelection()
|
||||
{
|
||||
if (!IsDropDownOpen)
|
||||
{
|
||||
SelectedIndex = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (SelectedIndex >= 0 || Items.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var firstVisibleTabIndex = GetFirstVisibleTabIndex();
|
||||
if (firstVisibleTabIndex < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SelectedIndex = firstVisibleTabIndex;
|
||||
}
|
||||
|
||||
private void RefreshHeaderCollection()
|
||||
{
|
||||
var itemsCount = Items.Count;
|
||||
for (var index = 0; index < itemsCount; ++index)
|
||||
{
|
||||
object header = null;
|
||||
if (ItemContainerGenerator.ContainerFromIndex(index) is RibbonTab ribbonTab)
|
||||
{
|
||||
header = ribbonTab.Header;
|
||||
}
|
||||
|
||||
header ??= string.Empty;
|
||||
|
||||
if (index >= _tabHeaderItemsSource.Count)
|
||||
{
|
||||
_tabHeaderItemsSource.Add(header);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tabHeaderItemsSource[index] = header;
|
||||
}
|
||||
}
|
||||
|
||||
var headerCount = _tabHeaderItemsSource.Count;
|
||||
for (var index = 0; index < headerCount - itemsCount; ++index)
|
||||
{
|
||||
_tabHeaderItemsSource.RemoveAt(itemsCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Interactivity;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonGroup : HeaderedItemsControl
|
||||
{
|
||||
public RibbonGroup()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.More, LauncherButton_OnClick));
|
||||
}
|
||||
|
||||
private void LauncherButton_OnClick(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
OnLauncherClick(new RoutedEventArgs(LauncherClickEvent, this));
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowLauncherButtonProperty = DependencyProperty.Register(
|
||||
"ShowLauncherButton", typeof(bool), typeof(RibbonGroup), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool ShowLauncherButton
|
||||
{
|
||||
get => (bool) GetValue(ShowLauncherButtonProperty);
|
||||
set => SetValue(ShowLauncherButtonProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ShowSplitterProperty = DependencyProperty.Register(
|
||||
"ShowSplitter", typeof(bool), typeof(RibbonGroup), new PropertyMetadata(ValueBoxes.TrueBox));
|
||||
|
||||
public bool ShowSplitter
|
||||
{
|
||||
get => (bool) GetValue(ShowSplitterProperty);
|
||||
set => SetValue(ShowSplitterProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LauncherPoptipProperty = DependencyProperty.Register(
|
||||
"LauncherPoptip", typeof(Poptip), typeof(RibbonGroup), new PropertyMetadata(default(Poptip)));
|
||||
|
||||
public Poptip LauncherPoptip
|
||||
{
|
||||
get => (Poptip) GetValue(LauncherPoptipProperty);
|
||||
set => SetValue(LauncherPoptipProperty, value);
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent LauncherClickEvent =
|
||||
EventManager.RegisterRoutedEvent("LauncherClick", RoutingStrategy.Bubble,
|
||||
typeof(RoutedEventHandler), typeof(RibbonGroup));
|
||||
|
||||
public event RoutedEventHandler LauncherClick
|
||||
{
|
||||
add => AddHandler(LauncherClickEvent, value);
|
||||
remove => RemoveHandler(LauncherClickEvent, value);
|
||||
}
|
||||
|
||||
protected virtual void OnLauncherClick(RoutedEventArgs e) => RaiseEvent(e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
[TemplatePart(Name = RootContainer, Type = typeof(UIElement))]
|
||||
public class RibbonTab : HeaderedItemsControl
|
||||
{
|
||||
private const string RootContainer = "PART_RootContainer";
|
||||
|
||||
private UIElement _rootContainer;
|
||||
|
||||
public Ribbon Ribbon => Ribbon.GetRibbon(this);
|
||||
|
||||
internal RibbonTabHeader RibbonTabHeader
|
||||
{
|
||||
get
|
||||
{
|
||||
var ribbon = Ribbon;
|
||||
if (ribbon == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var index = ribbon.ItemContainerGenerator.IndexFromContainer(this);
|
||||
if (index < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var headerItemsControl = ribbon.RibbonTabHeaderItemsControl;
|
||||
return headerItemsControl?.ItemContainerGenerator.ContainerFromIndex(index) as RibbonTabHeader;
|
||||
}
|
||||
}
|
||||
|
||||
static RibbonTab()
|
||||
{
|
||||
VisibilityProperty.OverrideMetadata(typeof(RibbonTab), new PropertyMetadata(Visibility.Visible, OnVisibilityChanged));
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsSelectedProperty =
|
||||
Selector.IsSelectedProperty.AddOwner(typeof(RibbonTab),
|
||||
new FrameworkPropertyMetadata(ValueBoxes.FalseBox,
|
||||
FrameworkPropertyMetadataOptions.AffectsParentMeasure |
|
||||
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault |
|
||||
FrameworkPropertyMetadataOptions.Journal,
|
||||
OnIsSelectedChanged));
|
||||
|
||||
private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ribbonTab = (RibbonTab) d;
|
||||
if (ribbonTab.IsSelected)
|
||||
{
|
||||
if (ribbonTab.Ribbon.IsDropDownOpen)
|
||||
{
|
||||
ribbonTab.SwitchContentVisibility(true);
|
||||
}
|
||||
|
||||
ribbonTab.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, ribbonTab));
|
||||
}
|
||||
else
|
||||
{
|
||||
ribbonTab.SwitchContentVisibility(false);
|
||||
ribbonTab.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, ribbonTab));
|
||||
}
|
||||
|
||||
ribbonTab.RibbonTabHeader?.CoerceValue(RibbonTabHeader.IsSelectedProperty);
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => (bool) GetValue(IsSelectedProperty);
|
||||
set => SetValue(IsSelectedProperty, value);
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
_rootContainer = GetTemplateChild(RootContainer) as UIElement;
|
||||
|
||||
SwitchContentVisibility(IsSelected);
|
||||
}
|
||||
|
||||
internal void SwitchContentVisibility(bool isVisible) => _rootContainer?.Show(isVisible);
|
||||
|
||||
protected virtual void OnSelected(RoutedEventArgs e) => RaiseEvent(e);
|
||||
|
||||
protected virtual void OnUnselected(RoutedEventArgs e) => RaiseEvent(e);
|
||||
|
||||
protected override void OnHeaderChanged(object oldHeader, object newHeader)
|
||||
{
|
||||
base.OnHeaderChanged(oldHeader, newHeader);
|
||||
Ribbon?.NotifyTabHeaderChanged();
|
||||
}
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RibbonGroup();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RibbonGroup;
|
||||
|
||||
private static void OnVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ribbonTab = (RibbonTab) d;
|
||||
ribbonTab.RibbonTabHeader?.CoerceValue(VisibilityProperty);
|
||||
|
||||
var ribbon = ribbonTab.Ribbon;
|
||||
if (ribbon == null ||
|
||||
!ribbonTab.IsSelected ||
|
||||
(Visibility) e.OldValue != Visibility.Visible ||
|
||||
(Visibility) e.NewValue == Visibility.Visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ribbon.ResetSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonTabHeader : ContentControl
|
||||
{
|
||||
public Ribbon Ribbon => Ribbon.GetRibbon(this);
|
||||
|
||||
internal RibbonTab RibbonTab
|
||||
{
|
||||
get
|
||||
{
|
||||
var itemsControl = ItemsControl.ItemsControlFromItemContainer(this);
|
||||
var ribbon = Ribbon;
|
||||
if (itemsControl == null || ribbon == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var index = itemsControl.ItemContainerGenerator.IndexFromContainer(this);
|
||||
return ribbon.ItemContainerGenerator.ContainerFromIndex(index) as RibbonTab;
|
||||
}
|
||||
}
|
||||
|
||||
static RibbonTabHeader()
|
||||
{
|
||||
VisibilityProperty.OverrideMetadata(typeof(RibbonTabHeader), new FrameworkPropertyMetadata(null, CoerceVisibility));
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
|
||||
"IsSelected", typeof(bool), typeof(RibbonTabHeader),
|
||||
new PropertyMetadata(ValueBoxes.FalseBox, OnIsSelectedChanged, CoerceIsSelected));
|
||||
|
||||
private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((RibbonTabHeader) d).OnIsSelectedChanged((bool) e.OldValue, (bool) e.NewValue);
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => (bool) GetValue(IsSelectedProperty);
|
||||
set => SetValue(IsSelectedProperty, value);
|
||||
}
|
||||
|
||||
internal void PrepareRibbonTabHeader()
|
||||
{
|
||||
CoerceValue(IsSelectedProperty);
|
||||
CoerceValue(VisibilityProperty);
|
||||
}
|
||||
|
||||
protected virtual void OnIsSelectedChanged(bool oldIsSelected, bool newIsSelected)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
var ribbon = Ribbon;
|
||||
if (ribbon != null)
|
||||
{
|
||||
ribbon.NotifyMouseClickedOnTabHeader(this, e);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
base.OnMouseLeftButtonDown(e);
|
||||
}
|
||||
|
||||
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
base.OnGotKeyboardFocus(e);
|
||||
|
||||
var ribbonTab = RibbonTab;
|
||||
if (ribbonTab == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ribbonTab.IsSelected = true;
|
||||
}
|
||||
|
||||
private static object CoerceIsSelected(DependencyObject d, object basevalue)
|
||||
{
|
||||
var ribbonTab = ((RibbonTabHeader) d).RibbonTab;
|
||||
return ribbonTab != null ? ValueBoxes.BooleanBox(ribbonTab.IsSelected) : basevalue;
|
||||
}
|
||||
|
||||
private static object CoerceVisibility(DependencyObject d, object basevalue)
|
||||
{
|
||||
var ribbonTab = ((RibbonTabHeader) d).RibbonTab;
|
||||
return ribbonTab != null ? ValueBoxes.VisibilityBox(ribbonTab.Visibility) : basevalue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class RibbonTabHeaderItemsControl : ItemsControl
|
||||
{
|
||||
protected override DependencyObject GetContainerForItemOverride() => new RibbonTabHeader();
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is RibbonTabHeader;
|
||||
|
||||
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
|
||||
{
|
||||
base.PrepareContainerForItemOverride(element, item);
|
||||
|
||||
if (element is RibbonTabHeader ribbonTabHeader)
|
||||
{
|
||||
ribbonTabHeader.PrepareRibbonTabHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Windows.Controls;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace HandyControl.Data;
|
||||
|
||||
@@ -15,10 +17,16 @@ internal static class ValueBoxes
|
||||
|
||||
internal static object HorizontalBox = Orientation.Horizontal;
|
||||
|
||||
internal static object Double0Box = .0;
|
||||
internal static object VisibleBox = Visibility.Visible;
|
||||
|
||||
internal static object CollapsedBox = Visibility.Collapsed;
|
||||
|
||||
internal static object HiddenBox = Visibility.Hidden;
|
||||
|
||||
internal static object Double01Box = .1;
|
||||
|
||||
internal static object Double0Box = .0;
|
||||
|
||||
internal static object Double1Box = 1.0;
|
||||
|
||||
internal static object Double10Box = 10.0;
|
||||
@@ -47,4 +55,15 @@ internal static class ValueBoxes
|
||||
|
||||
internal static object OrientationBox(Orientation value) =>
|
||||
value == Orientation.Horizontal ? HorizontalBox : VerticalBox;
|
||||
|
||||
internal static object VisibilityBox(Visibility value)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
Visibility.Visible => VisibleBox,
|
||||
Visibility.Hidden => HiddenBox,
|
||||
Visibility.Collapsed => CollapsedBox,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Poptip.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Watermark.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\AxleCanvas.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\ClipGrid.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\FlexPanel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\ElementGroup.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\SimpleStackPanel.cs" />
|
||||
@@ -72,6 +73,11 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\PropertyItem.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\PropertyItemsControl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\PropertyGrid\PropertyResolver.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\Ribbon.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonGroup.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTab.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTabHeader.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Ribbon\RibbonTabHeaderItemsControl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Screenshot\Screenshot.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Sprite.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\ToggleBlock.cs" />
|
||||
@@ -385,6 +391,9 @@
|
||||
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\ElementGroup.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Ribbon.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Themes\XamlCombine.exe" />
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Basic\Colors\Colors.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -181,4 +181,9 @@ public static class ControlCommands
|
||||
/// 按照名称排序
|
||||
/// </summary>
|
||||
public static RoutedCommand SortByName { get; } = new(nameof(SortByName), typeof(ControlCommands));
|
||||
|
||||
/// <summary>
|
||||
/// 更多
|
||||
/// </summary>
|
||||
public static RoutedCommand More { get; } = new(nameof(More), typeof(ControlCommands));
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItem.Small}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight" Value="20"/>
|
||||
<Setter Property="hc:InfoElement.ContentHeight" Value="20"/>
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,3"/>
|
||||
<Setter Property="Padding" Value="6,0"/>
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,0"/>
|
||||
<Setter Property="Padding" Value="6,2,6,1"/>
|
||||
<Setter Property="MinHeight" Value="20"/>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource ComboBoxPlusBaseStyle}" TargetType="hc:ComboBox"/>
|
||||
@@ -31,8 +32,9 @@
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItem.Small}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight" Value="20"/>
|
||||
<Setter Property="hc:InfoElement.ContentHeight" Value="20"/>
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,3"/>
|
||||
<Setter Property="Padding" Value="6,0"/>
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,0"/>
|
||||
<Setter Property="Padding" Value="6,2,6,1"/>
|
||||
<Setter Property="MinHeight" Value="20"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,163 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<Geometry x:Key="NailGeometry">M956.553 366.486L657.514 67.447c-7.888-7.888-18.204-11.772-28.52-11.772s-20.632 3.884-28.52 11.772L404.958 263.085c-14.806-1.7-29.734-2.428-44.662-2.428-88.837 0-177.675 29.249-250.614 87.746-18.69 14.927-20.268 42.962-3.277 59.953l220.516 220.517L65.506 890.046c-3.156 3.155-5.219 7.403-5.583 11.893l-4.126 45.147c-1.093 11.408 8.01 21.117 19.296 21.117 0.607 0 1.214 0 1.82-0.121l45.148-4.126c4.49-0.364 8.738-2.428 11.893-5.583L395.37 696.957l220.517 220.517c7.888 7.888 18.204 11.772 28.52 11.772 11.772 0 23.423-5.097 31.433-15.05 68.327-85.317 96.726-192.117 85.197-295.397l195.516-195.515c15.655-15.535 15.655-41.021 0-56.798zM699.142 557.268l-29.734 29.734 4.612 41.75c4.49 40.898 1.213 81.555-9.952 120.998-6.554 23.059-15.535 45.026-26.943 65.779L208.593 386.753c15.655-8.616 31.918-15.898 48.909-21.724 33.01-11.408 67.599-17.112 102.794-17.112 11.651 0 23.423 0.607 35.074 1.942l41.75 4.612 29.733-29.734 162.262-162.262 232.41 232.41-162.383 162.383z</Geometry>
|
||||
<Geometry x:Key="DialogBoxLauncherGeometry">M0,0 8,0 8,1 1,1 1,8 0,8 M 3.7,3 8,7.3 8,4 9,4 9,9 4,9 4,8 7.3,8 3,3.7</Geometry>
|
||||
|
||||
<Style TargetType="hc:RibbonGroup">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Height" Value="90"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Padding" Value="6 6 6 0"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonGroup">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ItemsPresenter Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}"/>
|
||||
<ContentPresenter Name="ContentPresenter" VerticalAlignment="Bottom" TextElement.Foreground="{DynamicResource SecondaryTextBrush}" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,2" ContentSource="Header" HorizontalAlignment="Center" Grid.Row="1"/>
|
||||
<Button hc:Poptip.Instance="{TemplateBinding LauncherPoptip}" Command="interactivity:ControlCommands.More" Visibility="{Binding ShowLauncherButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,2,0" Grid.Column="1" Width="16" Height="16" Grid.Row="1" HorizontalAlignment="Right" Style="{StaticResource ButtonCustom}" hc:BackgroundSwitchElement.MouseHoverBackground="{DynamicResource SecondaryRegionBrush}">
|
||||
<Path Width="9" Height="9" Stretch="Uniform" Data="{StaticResource DialogBoxLauncherGeometry}" Fill="{DynamicResource SecondaryTextBrush}"/>
|
||||
</Button>
|
||||
<Border Visibility="{Binding ShowSplitter,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,4" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Width="1" Background="{TemplateBinding BorderBrush}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ShowLauncherButton" Value="True">
|
||||
<Setter TargetName="ContentPresenter" Property="Margin" Value="20,0,20,2"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="hc:RibbonTabHeader">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTabHeader">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<hc:SimplePanel x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Border x:Name="BorderBottom" Visibility="{Binding IsSelected,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,2" Margin="12,0,12,2"/>
|
||||
<ContentPresenter x:Name="ContentPresenter" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="hc:RibbonTab">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTab">
|
||||
<hc:SimplePanel Visibility="Collapsed" x:Name="PART_RootContainer">
|
||||
<Border x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,3" Background="{TemplateBinding Background}" Margin="0"/>
|
||||
<ScrollViewer hc:ScrollViewerAttach.Orientation="Horizontal" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
|
||||
<ItemsPresenter/>
|
||||
</ScrollViewer>
|
||||
</hc:SimplePanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="hc:Ribbon">
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
|
||||
<Setter Property="ContentHeight" Value="96"/>
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||
<Setter Property="Padding" Value="10 0"/>
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<hc:SimplePanel/>
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:Ribbon">
|
||||
<hc:ClipGrid x:Name="PART_RootPanel" IsClipEnabled="False">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Name="PART_ContentPanel" Grid.Row="1" Grid.ColumnSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Margin="{TemplateBinding Padding}" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" ShadowDepth="2" Direction="-90" Color="{StaticResource EffectShadowColor}" Opacity=".1" RenderingBias="Performance"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<ItemsPresenter x:Name="PART_TabItemsPresenter" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.Column="0" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='1,0,0,0'}"/>
|
||||
<ToggleButton Command="interactivity:ControlCommands.Switch" IsChecked="{Binding IsMinimized, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" Padding="2 0" Width="16" Height="20" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconElement.Geometry="{StaticResource UpGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource NailGeometry}"/>
|
||||
</Grid>
|
||||
<ContentPresenter Grid.Row="0" Grid.Column="0" ContentSource="PrefixContent"/>
|
||||
<hc:RibbonTabHeaderItemsControl Grid.Row="0" Grid.Column="1" Background="{TemplateBinding Background}" Focusable="False" x:Name="PART_TabHeaderItemsControl" Margin="0,0,0,2">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Margin="{Binding Padding, RelativeSource={RelativeSource AncestorType= hc:Ribbon}}" Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</hc:RibbonTabHeaderItemsControl>
|
||||
<ContentPresenter Grid.Row="0" Grid.Column="2" ContentSource="PostfixContent"/>
|
||||
</hc:ClipGrid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -832,6 +832,31 @@
|
||||
<tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" />
|
||||
<hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" />
|
||||
<hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" />
|
||||
<Geometry x:Key="NailGeometry">M956.553 366.486L657.514 67.447c-7.888-7.888-18.204-11.772-28.52-11.772s-20.632 3.884-28.52 11.772L404.958 263.085c-14.806-1.7-29.734-2.428-44.662-2.428-88.837 0-177.675 29.249-250.614 87.746-18.69 14.927-20.268 42.962-3.277 59.953l220.516 220.517L65.506 890.046c-3.156 3.155-5.219 7.403-5.583 11.893l-4.126 45.147c-1.093 11.408 8.01 21.117 19.296 21.117 0.607 0 1.214 0 1.82-0.121l45.148-4.126c4.49-0.364 8.738-2.428 11.893-5.583L395.37 696.957l220.517 220.517c7.888 7.888 18.204 11.772 28.52 11.772 11.772 0 23.423-5.097 31.433-15.05 68.327-85.317 96.726-192.117 85.197-295.397l195.516-195.515c15.655-15.535 15.655-41.021 0-56.798zM699.142 557.268l-29.734 29.734 4.612 41.75c4.49 40.898 1.213 81.555-9.952 120.998-6.554 23.059-15.535 45.026-26.943 65.779L208.593 386.753c15.655-8.616 31.918-15.898 48.909-21.724 33.01-11.408 67.599-17.112 102.794-17.112 11.651 0 23.423 0.607 35.074 1.942l41.75 4.612 29.733-29.734 162.262-162.262 232.41 232.41-162.383 162.383z</Geometry>
|
||||
<Geometry x:Key="DialogBoxLauncherGeometry">M0,0 8,0 8,1 1,1 1,8 0,8 M 3.7,3 8,7.3 8,4 9,4 9,9 4,9 4,8 7.3,8 3,3.7</Geometry>
|
||||
<Style TargetType="hc:RibbonTab">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTab">
|
||||
<hc:SimplePanel Visibility="Collapsed" x:Name="PART_RootContainer">
|
||||
<Border x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,3" Background="{TemplateBinding Background}" Margin="0" />
|
||||
<ScrollViewer hc:ScrollViewerAttach.Orientation="Horizontal" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
|
||||
<ItemsPresenter />
|
||||
</ScrollViewer>
|
||||
</hc:SimplePanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<SolidColorBrush o:Freeze="True" x:Key="LightPrimaryBrush" Color="{DynamicResource LightPrimaryColor}" />
|
||||
<LinearGradientBrush o:Freeze="True" x:Key="PrimaryBrush" EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop o:Freeze="True" Color="{DynamicResource PrimaryColor}" Offset="0" />
|
||||
@@ -7138,16 +7163,18 @@
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItem.Small}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight" Value="20" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight" Value="20" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,3" />
|
||||
<Setter Property="Padding" Value="6,0" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,0" />
|
||||
<Setter Property="Padding" Value="6,2,6,1" />
|
||||
<Setter Property="MinHeight" Value="20" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource ComboBoxPlusBaseStyle}" TargetType="hc:ComboBox" />
|
||||
<Style x:Key="ComboBoxPlus.Small" BasedOn="{StaticResource ComboBoxPlusBaseStyle}" TargetType="hc:ComboBox">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItem.Small}" />
|
||||
<Setter Property="hc:InfoElement.MinContentHeight" Value="20" />
|
||||
<Setter Property="hc:InfoElement.ContentHeight" Value="20" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,3" />
|
||||
<Setter Property="Padding" Value="6,0" />
|
||||
<Setter Property="hc:TitleElement.MarginOnTheLeft" Value="0,3,6,0" />
|
||||
<Setter Property="Padding" Value="6,2,6,1" />
|
||||
<Setter Property="MinHeight" Value="20" />
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource WatermarkTextBoxBaseStyle}" TargetType="hc:WatermarkTextBox" />
|
||||
<Style BasedOn="{StaticResource TextBoxBaseStyle}" TargetType="TextBox" />
|
||||
@@ -10984,7 +11011,7 @@
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||
@@ -13485,6 +13512,132 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource RateBaseStyle}" TargetType="hc:Rate" />
|
||||
<Style TargetType="hc:RibbonGroup">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Height" Value="90" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
|
||||
<Setter Property="Padding" Value="6 6 6 0" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonGroup">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ItemsPresenter Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}" />
|
||||
<ContentPresenter Name="ContentPresenter" VerticalAlignment="Bottom" TextElement.Foreground="{DynamicResource SecondaryTextBrush}" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,10,2" ContentSource="Header" HorizontalAlignment="Center" Grid.Row="1" />
|
||||
<Button hc:Poptip.Instance="{TemplateBinding LauncherPoptip}" Command="interactivity:ControlCommands.More" Visibility="{Binding ShowLauncherButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,2,0" Grid.Column="1" Width="16" Height="16" Grid.Row="1" HorizontalAlignment="Right" Style="{StaticResource ButtonCustom}" hc:BackgroundSwitchElement.MouseHoverBackground="{DynamicResource SecondaryRegionBrush}">
|
||||
<Path Width="9" Height="9" Stretch="Uniform" Data="{StaticResource DialogBoxLauncherGeometry}" Fill="{DynamicResource SecondaryTextBrush}" />
|
||||
</Button>
|
||||
<Border Visibility="{Binding ShowSplitter,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,4" Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Width="1" Background="{TemplateBinding BorderBrush}" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="ShowLauncherButton" Value="True">
|
||||
<Setter TargetName="ContentPresenter" Property="Margin" Value="20,0,20,2" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="hc:RibbonTabHeader">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource TitleBrush}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
|
||||
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:RibbonTabHeader">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
<hc:SimplePanel x:Name="templateRoot" SnapsToDevicePixels="true">
|
||||
<Border x:Name="BorderBottom" Visibility="{Binding IsSelected,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,2" Margin="12,0,12,2" />
|
||||
<ContentPresenter x:Name="ContentPresenter" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" />
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="hc:Ribbon">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}" />
|
||||
<Setter Property="ContentHeight" Value="96" />
|
||||
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
|
||||
<Setter Property="Padding" Value="10 0" />
|
||||
<Setter Property="ItemsPanel">
|
||||
<Setter.Value>
|
||||
<ItemsPanelTemplate>
|
||||
<hc:SimplePanel />
|
||||
</ItemsPanelTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="hc:Ribbon">
|
||||
<hc:ClipGrid x:Name="PART_RootPanel" IsClipEnabled="False">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid x:Name="PART_ContentPanel" Grid.Row="1" Grid.ColumnSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Margin="{TemplateBinding Padding}" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="8" ShadowDepth="2" Direction="-90" Color="{StaticResource EffectShadowColor}" Opacity=".1" RenderingBias="Performance" />
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<ItemsPresenter x:Name="PART_TabItemsPresenter" VerticalAlignment="Bottom" Height="{TemplateBinding ContentHeight}" Grid.Column="0" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='1,0,0,0'}" />
|
||||
<ToggleButton Command="interactivity:ControlCommands.Switch" IsChecked="{Binding IsMinimized, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" Margin="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" Padding="2 0" Width="16" Height="20" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource ToggleButtonIconTransparent}" hc:IconElement.Geometry="{StaticResource UpGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource NailGeometry}" />
|
||||
</Grid>
|
||||
<ContentPresenter Grid.Row="0" Grid.Column="0" ContentSource="PrefixContent" />
|
||||
<hc:RibbonTabHeaderItemsControl Grid.Row="0" Grid.Column="1" Background="{TemplateBinding Background}" Focusable="False" x:Name="PART_TabHeaderItemsControl" Margin="0,0,0,2">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Margin="{Binding Padding, RelativeSource={RelativeSource AncestorType= hc:Ribbon}}" Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</hc:RibbonTabHeaderItemsControl>
|
||||
<ContentPresenter Grid.Row="0" Grid.Column="2" ContentSource="PostfixContent" />
|
||||
</hc:ClipGrid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style BasedOn="{StaticResource RunningBlockBaseStyle}" TargetType="hc:RunningBlock" />
|
||||
<Style BasedOn="{StaticResource SeparatorBaseStyle}" TargetType="Separator" />
|
||||
<Style BasedOn="{StaticResource ShieldBaseStyle}" TargetType="hc:Shield" />
|
||||
|
||||
@@ -169,6 +169,7 @@ Styles\PopupWindow.xaml
|
||||
Styles\ProgressButton.xaml
|
||||
Styles\PropertyGrid.xaml
|
||||
Styles\Rate.xaml
|
||||
Styles\Ribbon.xaml
|
||||
Styles\RichTextBox.xaml
|
||||
Styles\RunningBlock.xaml
|
||||
Styles\Screenshot.xaml
|
||||
|
||||
@@ -169,6 +169,7 @@ Styles\PopupWindow.xaml
|
||||
Styles\ProgressButton.xaml
|
||||
Styles\PropertyGrid.xaml
|
||||
Styles\Rate.xaml
|
||||
Styles\Ribbon.xaml
|
||||
Styles\RichTextBox.xaml
|
||||
Styles\RunningBlock.xaml
|
||||
Styles\Screenshot.xaml
|
||||
|
||||
Reference in new issue
Block a user