committed by
GitHub
119 changed files with 5237 additions and 1516 deletions
@ -0,0 +1,416 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Avalonia.Controls.Primitives; |
||||
|
using Avalonia.Data; |
||||
|
using Avalonia.Data.Converters; |
||||
|
using Avalonia.Layout; |
||||
|
using Avalonia.Media; |
||||
|
using Avalonia.Utilities; |
||||
|
|
||||
|
namespace Avalonia.Controls |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Enum which describes how to position the TickBar.
|
||||
|
/// </summary>
|
||||
|
public enum TickBarPlacement |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Position this tick at the left of target element.
|
||||
|
/// </summary>
|
||||
|
Left, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Position this tick at the top of target element.
|
||||
|
/// </summary>
|
||||
|
Top, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Position this tick at the right of target element.
|
||||
|
/// </summary>
|
||||
|
Right, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Position this tick at the bottom of target element.
|
||||
|
/// </summary>
|
||||
|
Bottom, |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// An element that is used for drawing <see cref="Slider"/>'s Ticks.
|
||||
|
/// </summary>
|
||||
|
public class TickBar : Control |
||||
|
{ |
||||
|
static TickBar() |
||||
|
{ |
||||
|
AffectsRender<TickBar>(ReservedSpaceProperty, |
||||
|
MaximumProperty, |
||||
|
MinimumProperty, |
||||
|
OrientationProperty, |
||||
|
TickFrequencyProperty); |
||||
|
} |
||||
|
|
||||
|
public TickBar() : base() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Fill"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<IBrush> FillProperty = |
||||
|
AvaloniaProperty.Register<TickBar, IBrush>(nameof(Fill)); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Brush used to fill the TickBar's Ticks.
|
||||
|
/// </summary>
|
||||
|
public IBrush Fill |
||||
|
{ |
||||
|
get { return GetValue(FillProperty); } |
||||
|
set { SetValue(FillProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Minimum"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<double> MinimumProperty = |
||||
|
AvaloniaProperty.Register<TickBar, double>(nameof(Minimum), 0d); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Logical position where the Minimum Tick will be drawn
|
||||
|
/// </summary>
|
||||
|
public double Minimum |
||||
|
{ |
||||
|
get { return GetValue(MinimumProperty); } |
||||
|
set |
||||
|
{ |
||||
|
SetValue(MinimumProperty, value); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Maximum"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<double> MaximumProperty = |
||||
|
AvaloniaProperty.Register<TickBar, double>(nameof(Maximum), 0d); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Logical position where the Maximum Tick will be drawn
|
||||
|
/// </summary>
|
||||
|
public double Maximum |
||||
|
{ |
||||
|
get { return GetValue(MaximumProperty); } |
||||
|
set { SetValue(MaximumProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="TickFrequency"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<double> TickFrequencyProperty = |
||||
|
AvaloniaProperty.Register<TickBar, double>(nameof(TickFrequency), 0d); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// TickFrequency property defines how the tick will be drawn.
|
||||
|
/// </summary>
|
||||
|
public double TickFrequency |
||||
|
{ |
||||
|
get { return GetValue(TickFrequencyProperty); } |
||||
|
set { SetValue(TickFrequencyProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Orientation"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<Orientation> OrientationProperty = |
||||
|
AvaloniaProperty.Register<TickBar, Orientation>(nameof(Orientation)); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// TickBar parent's orientation.
|
||||
|
/// </summary>
|
||||
|
public Orientation Orientation |
||||
|
{ |
||||
|
get { return GetValue(OrientationProperty); } |
||||
|
set { SetValue(OrientationProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Ticks"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<List<double>> TicksProperty = |
||||
|
AvaloniaProperty.Register<TickBar, List<double>>(nameof(Ticks)); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The Ticks property contains collection of value of type Double which
|
||||
|
/// are the logical positions use to draw the ticks.
|
||||
|
/// The property value is a <see cref="DoubleCollection" />.
|
||||
|
/// </summary>
|
||||
|
public List<double> Ticks |
||||
|
{ |
||||
|
get { return GetValue(TicksProperty); } |
||||
|
set { SetValue(TicksProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="IsDirectionReversed"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<bool> IsDirectionReversedProperty = |
||||
|
AvaloniaProperty.Register<TickBar, bool>(nameof(IsDirectionReversed), false); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The IsDirectionReversed property defines the direction of value incrementation.
|
||||
|
/// By default, if Tick's orientation is Horizontal, ticks will be drawn from left to right.
|
||||
|
/// (And, bottom to top for Vertical orientation).
|
||||
|
/// If IsDirectionReversed is 'true' the direction of the drawing will be in opposite direction.
|
||||
|
/// </summary>
|
||||
|
public bool IsDirectionReversed |
||||
|
{ |
||||
|
get { return GetValue(IsDirectionReversedProperty); } |
||||
|
set { SetValue(IsDirectionReversedProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="Placement"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<TickBarPlacement> PlacementProperty = |
||||
|
AvaloniaProperty.Register<TickBar, TickBarPlacement>(nameof(Placement), 0d); |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Placement property specified how the Tick will be placed.
|
||||
|
/// This property affects the way ticks are drawn.
|
||||
|
/// This property has type of <see cref="TickBarPlacement" />.
|
||||
|
/// </summary>
|
||||
|
public TickBarPlacement Placement |
||||
|
{ |
||||
|
get { return GetValue(PlacementProperty); } |
||||
|
set { SetValue(PlacementProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Defines the <see cref="ReservedSpace"/> property.
|
||||
|
/// </summary>
|
||||
|
public static readonly StyledProperty<Rect> ReservedSpaceProperty = |
||||
|
AvaloniaProperty.Register<TickBar, Rect>(nameof(ReservedSpace)); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// TickBar will use ReservedSpaceProperty for left and right spacing (for horizontal orientation) or
|
||||
|
/// tob and bottom spacing (for vertical orienation).
|
||||
|
/// The space on both sides of TickBar is half of specified ReservedSpace.
|
||||
|
/// This property has type of <see cref="Rect" />.
|
||||
|
/// </summary>
|
||||
|
public Rect ReservedSpace |
||||
|
{ |
||||
|
get { return GetValue(ReservedSpaceProperty); } |
||||
|
set { SetValue(ReservedSpaceProperty, value); } |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Draw ticks.
|
||||
|
/// Ticks can be draw in 8 diffrent ways depends on Placment property and IsDirectionReversed property.
|
||||
|
///
|
||||
|
/// This function also draw selection-tick(s) if IsSelectionRangeEnabled is 'true' and
|
||||
|
/// SelectionStart and SelectionEnd are valid.
|
||||
|
///
|
||||
|
/// The primary ticks (for Mininum and Maximum value) height will be 100% of TickBar's render size (use Width or Height
|
||||
|
/// depends on Placement property).
|
||||
|
///
|
||||
|
/// The secondary ticks (all other ticks, including selection-tics) height will be 75% of TickBar's render size.
|
||||
|
///
|
||||
|
/// Brush that use to fill ticks is specified by Shape.Fill property.
|
||||
|
///
|
||||
|
/// Pen that use to draw ticks is specified by Shape.Pen property.
|
||||
|
/// </summary>
|
||||
|
public override void Render(DrawingContext dc) |
||||
|
{ |
||||
|
var size = new Size(Bounds.Width, Bounds.Height); |
||||
|
var range = Maximum - Minimum; |
||||
|
var tickLen = 0.0d; // Height for Primary Tick (for Mininum and Maximum value)
|
||||
|
var tickLen2 = 0.0d; // Height for Secondary Tick
|
||||
|
var logicalToPhysical = 1.0; |
||||
|
var progression = 1.0d; |
||||
|
var startPoint = new Point(); |
||||
|
var endPoint = new Point(); |
||||
|
var rSpace = Orientation == Orientation.Horizontal ? ReservedSpace.Width : ReservedSpace.Height; |
||||
|
|
||||
|
// Take Thumb size in to account
|
||||
|
double halfReservedSpace = rSpace * 0.5; |
||||
|
|
||||
|
switch (Placement) |
||||
|
{ |
||||
|
case TickBarPlacement.Top: |
||||
|
if (MathUtilities.GreaterThanOrClose(rSpace, size.Width)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
size = new Size(size.Width - rSpace, size.Height); |
||||
|
tickLen = -size.Height; |
||||
|
startPoint = new Point(halfReservedSpace, size.Height); |
||||
|
endPoint = new Point(halfReservedSpace + size.Width, size.Height); |
||||
|
logicalToPhysical = size.Width / range; |
||||
|
progression = 1; |
||||
|
break; |
||||
|
|
||||
|
case TickBarPlacement.Bottom: |
||||
|
if (MathUtilities.GreaterThanOrClose(rSpace, size.Width)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
size = new Size(size.Width - rSpace, size.Height); |
||||
|
tickLen = size.Height; |
||||
|
startPoint = new Point(halfReservedSpace, 0d); |
||||
|
endPoint = new Point(halfReservedSpace + size.Width, 0d); |
||||
|
logicalToPhysical = size.Width / range; |
||||
|
progression = 1; |
||||
|
break; |
||||
|
|
||||
|
case TickBarPlacement.Left: |
||||
|
if (MathUtilities.GreaterThanOrClose(rSpace, size.Height)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
size = new Size(size.Width, size.Height - rSpace); |
||||
|
|
||||
|
tickLen = -size.Width; |
||||
|
startPoint = new Point(size.Width, size.Height + halfReservedSpace); |
||||
|
endPoint = new Point(size.Width, halfReservedSpace); |
||||
|
logicalToPhysical = size.Height / range * -1; |
||||
|
progression = -1; |
||||
|
break; |
||||
|
|
||||
|
case TickBarPlacement.Right: |
||||
|
if (MathUtilities.GreaterThanOrClose(rSpace, size.Height)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
size = new Size(size.Width, size.Height - rSpace); |
||||
|
tickLen = size.Width; |
||||
|
startPoint = new Point(0d, size.Height + halfReservedSpace); |
||||
|
endPoint = new Point(0d, halfReservedSpace); |
||||
|
logicalToPhysical = size.Height / range * -1; |
||||
|
progression = -1; |
||||
|
break; |
||||
|
}; |
||||
|
|
||||
|
tickLen2 = tickLen * 0.75; |
||||
|
|
||||
|
// Invert direciton of the ticks
|
||||
|
if (IsDirectionReversed) |
||||
|
{ |
||||
|
progression *= -progression; |
||||
|
logicalToPhysical *= -1; |
||||
|
|
||||
|
// swap startPoint & endPoint
|
||||
|
var pt = startPoint; |
||||
|
startPoint = endPoint; |
||||
|
endPoint = pt; |
||||
|
} |
||||
|
|
||||
|
var pen = new Pen(Fill, 1.0d); |
||||
|
|
||||
|
// Is it Vertical?
|
||||
|
if (Placement == TickBarPlacement.Left || Placement == TickBarPlacement.Right) |
||||
|
{ |
||||
|
// Reduce tick interval if it is more than would be visible on the screen
|
||||
|
double interval = TickFrequency; |
||||
|
if (interval > 0.0) |
||||
|
{ |
||||
|
double minInterval = (Maximum - Minimum) / size.Height; |
||||
|
if (interval < minInterval) |
||||
|
{ |
||||
|
interval = minInterval; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Draw Min & Max tick
|
||||
|
dc.DrawLine(pen, startPoint, new Point(startPoint.X + tickLen, startPoint.Y)); |
||||
|
dc.DrawLine(pen, new Point(startPoint.X, endPoint.Y), |
||||
|
new Point(startPoint.X + tickLen, endPoint.Y)); |
||||
|
|
||||
|
// This property is rarely set so let's try to avoid the GetValue
|
||||
|
// caching of the mutable default value
|
||||
|
var ticks = Ticks ?? null; |
||||
|
|
||||
|
// Draw ticks using specified Ticks collection
|
||||
|
if (ticks?.Count > 0) |
||||
|
{ |
||||
|
for (int i = 0; i < ticks.Count; i++) |
||||
|
{ |
||||
|
if (MathUtilities.LessThanOrClose(ticks[i], Minimum) || MathUtilities.GreaterThanOrClose(ticks[i], Maximum)) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
double adjustedTick = ticks[i] - Minimum; |
||||
|
|
||||
|
double y = adjustedTick * logicalToPhysical + startPoint.Y; |
||||
|
dc.DrawLine(pen, |
||||
|
new Point(startPoint.X, y), |
||||
|
new Point(startPoint.X + tickLen2, y)); |
||||
|
} |
||||
|
} |
||||
|
// Draw ticks using specified TickFrequency
|
||||
|
else if (interval > 0.0) |
||||
|
{ |
||||
|
for (double i = interval; i < range; i += interval) |
||||
|
{ |
||||
|
double y = i * logicalToPhysical + startPoint.Y; |
||||
|
|
||||
|
dc.DrawLine(pen, |
||||
|
new Point(startPoint.X, y), |
||||
|
new Point(startPoint.X + tickLen2, y)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else // Placement == Top || Placement == Bottom
|
||||
|
{ |
||||
|
// Reduce tick interval if it is more than would be visible on the screen
|
||||
|
double interval = TickFrequency; |
||||
|
if (interval > 0.0) |
||||
|
{ |
||||
|
double minInterval = (Maximum - Minimum) / size.Width; |
||||
|
if (interval < minInterval) |
||||
|
{ |
||||
|
interval = minInterval; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// Draw Min & Max tick
|
||||
|
dc.DrawLine(pen, startPoint, new Point(startPoint.X, startPoint.Y + tickLen)); |
||||
|
dc.DrawLine(pen, new Point(endPoint.X, startPoint.Y), |
||||
|
new Point(endPoint.X, startPoint.Y + tickLen)); |
||||
|
|
||||
|
// This property is rarely set so let's try to avoid the GetValue
|
||||
|
// caching of the mutable default value
|
||||
|
var ticks = Ticks ?? null; |
||||
|
|
||||
|
// Draw ticks using specified Ticks collection
|
||||
|
if (ticks?.Count > 0) |
||||
|
{ |
||||
|
for (int i = 0; i < ticks.Count; i++) |
||||
|
{ |
||||
|
if (MathUtilities.LessThanOrClose(ticks[i], Minimum) || MathUtilities.GreaterThanOrClose(ticks[i], Maximum)) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
double adjustedTick = ticks[i] - Minimum; |
||||
|
|
||||
|
double x = adjustedTick * logicalToPhysical + startPoint.X; |
||||
|
dc.DrawLine(pen, |
||||
|
new Point(x, startPoint.Y), |
||||
|
new Point(x, startPoint.Y + tickLen2)); |
||||
|
} |
||||
|
} |
||||
|
// Draw ticks using specified TickFrequency
|
||||
|
else if (interval > 0.0) |
||||
|
{ |
||||
|
for (double i = interval; i < range; i += interval) |
||||
|
{ |
||||
|
double x = i * logicalToPhysical + startPoint.X; |
||||
|
dc.DrawLine(pen, |
||||
|
new Point(x, startPoint.Y), |
||||
|
new Point(x, startPoint.Y + tickLen2)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,104 +1,140 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" |
||||
<Style Selector="ButtonSpinner"> |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
<Setter Property="Background" Value="Transparent"/> |
xmlns:sys="clr-namespace:System;assembly=netstandard" |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"> |
||||
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> |
<Design.PreviewWith> |
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
<Border Padding="20" |
||||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
Background="Black"> |
||||
|
<StackPanel Spacing="20"> |
||||
|
<ButtonSpinner ButtonSpinnerLocation="Right" |
||||
|
Content="Right disabled inline spinner" |
||||
|
AllowSpin="False" /> |
||||
|
<ButtonSpinner ButtonSpinnerLocation="Left" |
||||
|
Content="Left spinner" /> |
||||
|
<ButtonSpinner ShowButtonSpinner="False" |
||||
|
Content="Hide spinner" /> |
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
|
|
||||
|
<Styles.Resources> |
||||
|
<converters:MarginMultiplierConverter x:Key="ButtonSpinner_OnlyLeftThinknessConverter" |
||||
|
Indent="1" |
||||
|
Left="True" /> |
||||
|
<converters:MarginMultiplierConverter x:Key="ButtonSpinner_OnlyRightThinknessConverter" |
||||
|
Indent="1" |
||||
|
Right="True" /> |
||||
|
|
||||
|
<StreamGeometry x:Key="ButtonSpinnerIncreaseButtonIcon">M0,9 L10,0 20,9 19,10 10,2 1,10 z</StreamGeometry> |
||||
|
<StreamGeometry x:Key="ButtonSpinnerDecreaseButtonIcon">M0,1 L10,10 20,1 19,0 10,8 1,0 z</StreamGeometry> |
||||
|
</Styles.Resources> |
||||
|
|
||||
|
<!-- RepeatButton.ButtonSpinnerRepeatButton --> |
||||
|
<Style Selector="RepeatButton.ButtonSpinnerRepeatButton"> |
||||
|
<Setter Property="MinWidth" Value="34" /> |
||||
|
<Setter Property="VerticalAlignment" Value="Stretch" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner /template/ RepeatButton"> |
|
||||
<Setter Property="Background" Value="Transparent"/> |
<Style Selector="RepeatButton.ButtonSpinnerRepeatButton /template/ ContentPresenter"> |
||||
<Setter Property="BorderBrush" Value="Transparent"/> |
<Setter Property="CornerRadius" Value="0" /> |
||||
|
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner /template/ RepeatButton:pointerover"> |
<Style Selector="RepeatButton.ButtonSpinnerRepeatButton:disabled"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/> |
<Setter Property="BorderBrush" Value="{TemplateBinding BorderBrush}" /> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
|
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner /template/ RepeatButton#PART_IncreaseButton"> |
<Style Selector="RepeatButton.ButtonSpinnerRepeatButton:disabled > Path"> |
||||
<Setter Property="Content"> |
<Setter Property="Fill" Value="{DynamicResource RepeatButtonForegroundDisabled}" /> |
||||
<Template> |
|
||||
<Path Fill="{DynamicResource ThemeForegroundBrush}" |
|
||||
Width="8" |
|
||||
Height="4" |
|
||||
Stretch="Uniform" |
|
||||
HorizontalAlignment="Center" |
|
||||
VerticalAlignment="Center" |
|
||||
Data="M0,5 L4.5,.5 9,5 6,5 4.5,3.5 3,5 z"/> |
|
||||
</Template> |
|
||||
</Setter> |
|
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner /template/ RepeatButton#PART_DecreaseButton"> |
|
||||
<Setter Property="Content"> |
<!-- ButtonSpinner --> |
||||
<Template> |
<Style Selector="ButtonSpinner"> |
||||
<Path Fill="{DynamicResource ThemeForegroundBrush}" |
<Setter Property="Background" Value="Transparent" /> |
||||
Width="8" |
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" /> |
||||
Height="4" |
<Setter Property="Padding" Value="10, 0" /> |
||||
Stretch="Uniform" |
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" /> |
||||
HorizontalAlignment="Center" |
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> |
||||
VerticalAlignment="Center" |
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" /> |
||||
Data="M0,0 L3,0 4.5,1.5 6,0 9,0 4.5,4.5 z"/> |
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" /> |
||||
</Template> |
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" /> |
||||
</Setter> |
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
</Style> |
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
||||
<Style Selector="ButtonSpinner:right"> |
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
||||
|
<Setter Property="VerticalContentAlignment" Value="Center" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<Border Name="border" |
<Border Background="{TemplateBinding Background}" |
||||
Background="{TemplateBinding Background}" |
|
||||
BorderBrush="{TemplateBinding BorderBrush}" |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
Margin="{TemplateBinding Padding}" |
CornerRadius="{DynamicResource ControlCornerRadius}"> |
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
<Grid ColumnDefinitions="Auto,*,Auto"> |
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"> |
<ContentPresenter Name="PART_ContentPresenter" |
||||
<Grid ColumnDefinitions="*,Auto"> |
Grid.Column="1" |
||||
<ContentPresenter Name="PART_ContentPresenter" Grid.Column="0" |
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
ContentTemplate="{TemplateBinding ContentTemplate}" |
||||
Content="{TemplateBinding Content}" |
Content="{TemplateBinding Content}" |
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
||||
Padding="{TemplateBinding Padding}"/> |
Padding="{TemplateBinding Padding}" /> |
||||
<Grid Grid.Column="1" RowDefinitions="*,*" IsVisible="{TemplateBinding ShowButtonSpinner}"> |
|
||||
<RepeatButton Grid.Row="0" Name="PART_IncreaseButton"/> |
<StackPanel Name="PART_SpinnerPanel" |
||||
<RepeatButton Grid.Row="1" Name="PART_DecreaseButton"/> |
Orientation="Horizontal" |
||||
</Grid> |
IsVisible="{TemplateBinding ShowButtonSpinner}"> |
||||
|
<RepeatButton Name="PART_IncreaseButton" |
||||
|
Classes="ButtonSpinnerRepeatButton" |
||||
|
VerticalContentAlignment="Center" |
||||
|
Foreground="{TemplateBinding Foreground}" |
||||
|
BorderBrush="{TemplateBinding BorderBrush}" |
||||
|
Background="{TemplateBinding Background}" |
||||
|
FontSize="{TemplateBinding FontSize}"> |
||||
|
<Path Fill="{TemplateBinding Foreground}" |
||||
|
Width="16" |
||||
|
Height="8" |
||||
|
Stretch="Uniform" |
||||
|
HorizontalAlignment="Center" |
||||
|
VerticalAlignment="Center" |
||||
|
Data="{StaticResource ButtonSpinnerIncreaseButtonIcon}" /> |
||||
|
</RepeatButton> |
||||
|
|
||||
|
<RepeatButton Name="PART_DecreaseButton" |
||||
|
Classes="ButtonSpinnerRepeatButton" |
||||
|
Foreground="{TemplateBinding Foreground}" |
||||
|
BorderBrush="{TemplateBinding BorderBrush}" |
||||
|
Background="{TemplateBinding Background}" |
||||
|
VerticalContentAlignment="Center" |
||||
|
FontSize="{TemplateBinding FontSize}"> |
||||
|
<Path Fill="{TemplateBinding Foreground}" |
||||
|
Width="16" |
||||
|
Height="8" |
||||
|
Stretch="Uniform" |
||||
|
HorizontalAlignment="Center" |
||||
|
VerticalAlignment="Center" |
||||
|
Data="{StaticResource ButtonSpinnerDecreaseButtonIcon}" /> |
||||
|
</RepeatButton> |
||||
|
</StackPanel> |
||||
</Grid> |
</Grid> |
||||
</Border> |
</Border> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner:left"> |
|
||||
<Setter Property="Template"> |
<!-- ButtonSpinnerLocation=Right --> |
||||
<ControlTemplate> |
<Style Selector="ButtonSpinner:right /template/ StackPanel#PART_SpinnerPanel"> |
||||
<Border Name="border" |
<Setter Property="Grid.Column" Value="2" /> |
||||
Background="{TemplateBinding Background}" |
</Style> |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
<Style Selector="ButtonSpinner:right /template/ RepeatButton.ButtonSpinnerRepeatButton"> |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
<Setter Property="BorderThickness" Value="{Binding $parent[ButtonSpinner].BorderThickness, Converter={StaticResource ButtonSpinner_OnlyLeftThinknessConverter}}" /> |
||||
Margin="{TemplateBinding Padding}" |
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"> |
|
||||
<Grid ColumnDefinitions="Auto,*"> |
|
||||
<Grid Grid.Column="0" RowDefinitions="*,*" IsVisible="{TemplateBinding ShowButtonSpinner}"> |
|
||||
<RepeatButton Grid.Row="0" Name="PART_IncreaseButton"/> |
|
||||
<RepeatButton Grid.Row="1" Name="PART_DecreaseButton"/> |
|
||||
</Grid> |
|
||||
<ContentPresenter Name="PART_ContentPresenter" Grid.Column="1" |
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
|
||||
Content="{TemplateBinding Content}" |
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
|
||||
Padding="{TemplateBinding Padding}"/> |
|
||||
</Grid> |
|
||||
</Border> |
|
||||
</ControlTemplate> |
|
||||
</Setter> |
|
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner:pointerover /template/ Border#border"> |
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> |
<!-- ButtonSpinnerLocation=Left --> |
||||
|
<Style Selector="ButtonSpinner:left /template/ StackPanel#PART_SpinnerPanel"> |
||||
|
<Setter Property="Grid.Column" Value="0" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner:focus /template/ Border#border"> |
<Style Selector="ButtonSpinner:left /template/ RepeatButton.ButtonSpinnerRepeatButton"> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/> |
<Setter Property="BorderThickness" Value="{Binding $parent[ButtonSpinner].BorderThickness, Converter={StaticResource ButtonSpinner_OnlyRightThinknessConverter}}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ButtonSpinner:error /template/ Border#border"> |
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}"/> |
<!-- Error state --> |
||||
|
<Style Selector="ButtonSpinner:error"> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ErrorBrush}" /> |
||||
</Style> |
</Style> |
||||
|
|
||||
</Styles> |
</Styles> |
||||
|
|||||
@ -0,0 +1,6 @@ |
|||||
|
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
<Style Selector="TextBlock.CaptionTextBlockStyle"> |
||||
|
<Setter Property="FontSize" Value="12" /> |
||||
|
<Setter Property="FontWeight" Value="Normal" /> |
||||
|
</Style> |
||||
|
</Styles> |
||||
@ -1,16 +1,34 @@ |
|||||
<Style xmlns="https://github.com/avaloniaui" Selector="Menu"> |
<Style xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
Selector="Menu"> |
||||
|
<Design.PreviewWith> |
||||
|
<Border Padding="20"> |
||||
|
<Menu> |
||||
|
<MenuItem Header="New" /> |
||||
|
<MenuItem Header="Open" /> |
||||
|
</Menu> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
|
|
||||
|
<Style.Resources> |
||||
|
<x:Double x:Key="MenuHeight">32</x:Double> |
||||
|
</Style.Resources> |
||||
|
<Setter Property="Background" Value="Transparent" /> |
||||
|
<Setter Property="Height" Value="{StaticResource MenuHeight}" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<Border Background="{TemplateBinding Background}" |
<Border Background="{TemplateBinding Background}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
|
HorizontalAlignment="Stretch" |
||||
Padding="{TemplateBinding Padding}"> |
Padding="{TemplateBinding Padding}"> |
||||
<ItemsPresenter Name="PART_ItemsPresenter" |
<ItemsPresenter Name="PART_ItemsPresenter" |
||||
Items="{TemplateBinding Items}" |
Items="{TemplateBinding Items}" |
||||
ItemsPanel="{TemplateBinding ItemsPanel}" |
ItemsPanel="{TemplateBinding ItemsPanel}" |
||||
ItemTemplate="{TemplateBinding ItemTemplate}" |
ItemTemplate="{TemplateBinding ItemTemplate}" |
||||
KeyboardNavigation.TabNavigation="Continue"/> |
VerticalAlignment="Stretch" |
||||
|
KeyboardNavigation.TabNavigation="Continue" /> |
||||
</Border> |
</Border> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
|
|||||
@ -1,38 +1,60 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
<Design.PreviewWith> |
||||
|
<Border Padding="20" |
||||
|
Background="Black"> |
||||
|
<StackPanel Spacing="20"> |
||||
|
<NumericUpDown Minimum="0" |
||||
|
Maximum="10" |
||||
|
Increment="0.5" |
||||
|
Width="150" |
||||
|
Watermark="Enter text" /> |
||||
|
<NumericUpDown Minimum="0" |
||||
|
Maximum="10" |
||||
|
Increment="0.5" |
||||
|
Width="150" |
||||
|
ButtonSpinnerLocation="Left" |
||||
|
Watermark="Enter text" /> |
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
|
|
||||
<Style Selector="NumericUpDown"> |
<Style Selector="NumericUpDown"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> |
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" /> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" /> |
||||
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> |
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" /> |
||||
<Setter Property="Padding" Value="4"/> |
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> |
||||
|
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" /> |
||||
|
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" /> |
||||
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
||||
|
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<ButtonSpinner Name="PART_Spinner" |
<ButtonSpinner Name="PART_Spinner" |
||||
Background="{TemplateBinding Background}" |
Background="{TemplateBinding Background}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
|
Padding="0" |
||||
HorizontalContentAlignment="Stretch" |
HorizontalContentAlignment="Stretch" |
||||
VerticalContentAlignment="Stretch" |
VerticalContentAlignment="Stretch" |
||||
AllowSpin="{TemplateBinding AllowSpin}" |
AllowSpin="{TemplateBinding AllowSpin}" |
||||
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" |
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}" |
||||
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"> |
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"> |
||||
<TextBox Name="PART_TextBox" |
<TextBox Name="PART_TextBox" |
||||
BorderThickness="0" |
Background="Transparent" |
||||
Background="{TemplateBinding Background}" |
BorderBrush="Transparent" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
Margin="-2" |
||||
Padding="{TemplateBinding Padding}" |
Padding="{TemplateBinding Padding}" |
||||
Watermark="{TemplateBinding Watermark}" |
Watermark="{TemplateBinding Watermark}" |
||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" |
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" |
||||
IsReadOnly="{TemplateBinding IsReadOnly}" |
IsReadOnly="{TemplateBinding IsReadOnly}" |
||||
Text="{TemplateBinding Text}" |
Text="{TemplateBinding Text}" |
||||
AcceptsReturn="False" |
AcceptsReturn="False" |
||||
TextWrapping="NoWrap"> |
TextWrapping="NoWrap" /> |
||||
</TextBox> |
|
||||
</ButtonSpinner> |
</ButtonSpinner> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="NumericUpDown /template/ TextBox#PART_TextBox"> |
|
||||
<Setter Property="Margin" Value="4"/> |
</Styles> |
||||
<Setter Property="MinWidth" Value="20"/> |
|
||||
</Style> |
|
||||
</Styles> |
|
||||
|
|||||
@ -1,40 +1,62 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<Style Selector="RepeatButton"> |
<Design.PreviewWith> |
||||
<Setter Property="Background" |
<Border Padding="20"> |
||||
Value="{DynamicResource ThemeControlMidBrush}" /> |
<StackPanel Spacing="20"> |
||||
<Setter Property="BorderBrush" |
<RepeatButton Content="Click Me!" /> |
||||
Value="{DynamicResource ThemeBorderLowBrush}" /> |
</StackPanel> |
||||
<Setter Property="BorderThickness" |
</Border> |
||||
Value="{DynamicResource ThemeBorderThickness}" /> |
</Design.PreviewWith> |
||||
<Setter Property="Foreground" |
<Styles.Resources> |
||||
Value="{DynamicResource ThemeForegroundBrush}" /> |
<Thickness x:Key="ButtonPadding">8,5,8,6</Thickness> |
||||
<Setter Property="HorizontalContentAlignment" |
</Styles.Resources> |
||||
Value="Center" /> |
<Style Selector="RepeatButton"> |
||||
<Setter Property="VerticalContentAlignment" |
<Setter Property="Background" Value="{DynamicResource RepeatButtonBackground}" /> |
||||
Value="Center" /> |
<!--<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />--> |
||||
<Setter Property="Padding" |
<Setter Property="Foreground" Value="{DynamicResource RepeatButtonForeground}" /> |
||||
Value="4" /> |
<Setter Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrush}" /> |
||||
<Setter Property="Template"> |
<Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThemeThickness}" /> |
||||
<ControlTemplate> |
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" /> |
||||
<ContentPresenter Name="PART_ContentPresenter" |
<Setter Property="HorizontalAlignment" Value="Left" /> |
||||
Background="{TemplateBinding Background}" |
<Setter Property="VerticalAlignment" Value="Center" /> |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
<Setter Property="FontWeight" Value="Normal" /> |
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
||||
Content="{TemplateBinding Content}" |
<!--<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" /> |
||||
Padding="{TemplateBinding Padding}" |
<Setter Property="FocusVisualMargin" Value="-3" />--> |
||||
TextBlock.Foreground="{TemplateBinding Foreground}" |
<Setter Property="Template"> |
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
<ControlTemplate> |
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> |
<ContentPresenter x:Name="PART_ContentPresenter" |
||||
</ControlTemplate> |
Background="{TemplateBinding Background}" |
||||
</Setter> |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
</Style> |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
<Style Selector="RepeatButton:pointerover /template/ ContentPresenter"> |
Content="{TemplateBinding Content}" |
||||
<Setter Property="BorderBrush" |
ContentTemplate="{TemplateBinding ContentTemplate}" |
||||
Value="{DynamicResource ThemeBorderMidBrush}" /> |
Padding="{TemplateBinding Padding}" |
||||
</Style> |
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
||||
<Style Selector="RepeatButton:disabled"> |
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> |
||||
<Setter Property="Opacity" |
</ControlTemplate> |
||||
Value="{DynamicResource ThemeDisabledOpacity}" /> |
</Setter> |
||||
</Style> |
</Style> |
||||
|
|
||||
|
<Style Selector="RepeatButton /template/ ContentPresenter"> |
||||
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="RepeatButton:pointerover /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource RepeatButtonBackgroundPointerOver}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushPointerOver}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource RepeatButtonForegroundPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="RepeatButton:pressed /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource RepeatButtonBackgroundPressed}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushPressed}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource RepeatButtonForegroundPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="RepeatButton:disabled /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource RepeatButtonBackgroundDisabled}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource RepeatButtonBorderBrushDisabled}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource RepeatButtonForegroundDisabled}" /> |
||||
|
</Style> |
||||
</Styles> |
</Styles> |
||||
|
|||||
@ -1,93 +1,264 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
<Design.PreviewWith> |
||||
|
<Border Margin="20" Width="200" Height="200"> |
||||
|
<DockPanel LastChildFill="True"> |
||||
|
<StackPanel Spacing="10" DockPanel.Dock="Top"> |
||||
|
<Slider Value="50" /> |
||||
|
<Slider IsEnabled="False" Value="50" /> |
||||
|
</StackPanel> |
||||
|
<StackPanel Spacing="10" Orientation="Horizontal"> |
||||
|
<Slider Value="50" Orientation="Vertical" /> |
||||
|
<Slider IsEnabled="False" Orientation="Vertical" Value="50" /> |
||||
|
</StackPanel> |
||||
|
</DockPanel> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
|
<Styles.Resources> |
||||
|
<Thickness x:Key="SliderTopHeaderMargin">0,0,0,4</Thickness> |
||||
|
<GridLength x:Key="SliderPreContentMargin">15</GridLength> |
||||
|
<GridLength x:Key="SliderPostContentMargin">15</GridLength> |
||||
|
<x:Double x:Key="SliderHorizontalHeight">32</x:Double> |
||||
|
<x:Double x:Key="SliderVerticalWidth">32</x:Double> |
||||
|
<CornerRadius x:Key="SliderThumbCornerRadius">10</CornerRadius> |
||||
|
<x:Double x:Key="SliderHorizontalThumbWidth">20</x:Double> |
||||
|
<x:Double x:Key="SliderHorizontalThumbHeight">20</x:Double> |
||||
|
<x:Double x:Key="SliderVerticalThumbWidth">20</x:Double> |
||||
|
<x:Double x:Key="SliderVerticalThumbHeight">20</x:Double> |
||||
|
</Styles.Resources> |
||||
|
<Style Selector="Thumb.SliderThumbStyle"> |
||||
|
<Setter Property="BorderThickness" Value="0" /> |
||||
|
<Setter Property="Template"> |
||||
|
<Setter.Value> |
||||
|
<ControlTemplate> |
||||
|
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{DynamicResource SliderThumbCornerRadius}" /> |
||||
|
</ControlTemplate> |
||||
|
</Setter.Value> |
||||
|
</Setter> |
||||
|
</Style> |
||||
<Style Selector="Slider:horizontal"> |
<Style Selector="Slider:horizontal"> |
||||
<Setter Property="MinWidth" Value="40"/> |
<Setter Property="Background" Value="{DynamicResource SliderTrackFill}" /> |
||||
<Setter Property="MinHeight" Value="20"/> |
<Setter Property="BorderThickness" Value="{DynamicResource SliderBorderThemeThickness}" /> |
||||
|
<Setter Property="Foreground" Value="{DynamicResource SliderTrackValueFill}" /> |
||||
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<Grid Name="grid"> |
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{DynamicResource ControlCornerRadius}"> |
||||
<Grid.RowDefinitions> |
<Grid Name="grid" Margin="{TemplateBinding Padding}" RowDefinitions="Auto, *"> |
||||
<RowDefinition Height="Auto"/> |
<ContentPresenter x:Name="HeaderContentPresenter" Grid.Row="0" TextBlock.FontWeight="{DynamicResource SliderHeaderThemeFontWeight}" TextBlock.Foreground="{DynamicResource SliderHeaderForeground}" |
||||
<RowDefinition Height="Auto" MinHeight="20"/> |
Margin="{DynamicResource SliderTopHeaderMargin}" /> |
||||
<RowDefinition Height="Auto"/> |
<Grid x:Name="SliderContainer" Grid.Row="1"> |
||||
</Grid.RowDefinitions> |
<Grid.Styles> |
||||
<Border Name="TrackBackground" Grid.Row="1" Height="4" Margin="6,0" VerticalAlignment="Center"/> |
<Style Selector="TickBar"> |
||||
<Track Name="PART_Track" Grid.Row="1" Orientation="Horizontal"> |
<Setter Property="ReservedSpace" Value="{Binding #PART_Track.Thumb.Bounds}" /> |
||||
<Track.DecreaseButton> |
</Style> |
||||
<RepeatButton Name="PART_DecreaseButton" |
</Grid.Styles> |
||||
Classes="repeattrack" /> |
<Grid x:Name="HorizontalTemplate" ColumnDefinitions="Auto,Auto,*" MinHeight="{DynamicResource SliderHorizontalHeight}"> |
||||
</Track.DecreaseButton> |
<Grid.RowDefinitions> |
||||
<Track.IncreaseButton> |
<RowDefinition Height="{DynamicResource SliderPreContentMargin}" /> |
||||
<RepeatButton Name="PART_IncreaseButton" |
<RowDefinition Height="Auto" /> |
||||
Classes="repeattrack" /> |
<RowDefinition Height="{DynamicResource SliderPostContentMargin}" /> |
||||
</Track.IncreaseButton> |
</Grid.RowDefinitions> |
||||
<Thumb Name="thumb" MinWidth="20" MinHeight="20"> |
<TickBar Name="TopTickBar" Placement="Top" Height="{DynamicResource SliderOutsideTickBarThemeHeight}" VerticalAlignment="Bottom" Margin="0,0,0,4" Grid.ColumnSpan="3" /> |
||||
<Thumb.Template> |
<!-- <TickBar Name="HorizontalInlineTickBar" Placement="Top" Fill="{DynamicResource SliderInlineTickBarFill}" Height="{DynamicResource SliderTrackThemeHeight}" Grid.Row="1" Grid.ColumnSpan="3" /> --> |
||||
<ControlTemplate> |
<TickBar Name="BottomTickBar" Placement="Bottom" Height="{DynamicResource SliderOutsideTickBarThemeHeight}" VerticalAlignment="Top" Margin="0,4,0,0" Grid.Row="2" Grid.ColumnSpan="3" /> |
||||
<Grid> |
<Track Name="PART_Track" Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal"> |
||||
<Ellipse Width="12" Height="12" Fill="{DynamicResource ThemeAccentBrush}"/> |
<Track.DecreaseButton> |
||||
</Grid> |
<RepeatButton Name="PART_DecreaseButton" Background="{TemplateBinding Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
||||
</ControlTemplate> |
<RepeatButton.Template> |
||||
</Thumb.Template> |
<ControlTemplate> |
||||
</Thumb> |
<Grid> |
||||
</Track> |
<Border Name="FocusTarget" Background="Transparent" Margin="0,-10" /> |
||||
</Grid> |
<Border Name="TrackBackground" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}" Height="{DynamicResource SliderTrackThemeHeight}" VerticalAlignment="Center" /> |
||||
|
</Grid> |
||||
|
</ControlTemplate> |
||||
|
</RepeatButton.Template> |
||||
|
</RepeatButton> |
||||
|
</Track.DecreaseButton> |
||||
|
<Track.IncreaseButton> |
||||
|
<RepeatButton Name="PART_IncreaseButton" Background="{TemplateBinding Background}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> |
||||
|
<RepeatButton.Template> |
||||
|
<ControlTemplate> |
||||
|
<Grid> |
||||
|
<Border Name="FocusTarget" Background="Transparent" Margin="0,-10" /> |
||||
|
<Border Name="TrackBackground" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}" Height="{DynamicResource SliderTrackThemeHeight}" VerticalAlignment="Center" /> |
||||
|
</Grid> |
||||
|
</ControlTemplate> |
||||
|
</RepeatButton.Template> |
||||
|
</RepeatButton> |
||||
|
</Track.IncreaseButton> |
||||
|
<Thumb Classes="SliderThumbStyle" Name="thumb" Margin="0" Padding="0" DataContext="{TemplateBinding Value}" Height="{DynamicResource SliderHorizontalThumbHeight}" Width="{DynamicResource SliderHorizontalThumbWidth}" /> |
||||
|
</Track> |
||||
|
</Grid> |
||||
|
</Grid> |
||||
|
</Grid> |
||||
|
</Border> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="Slider:vertical"> |
<Style Selector="Slider:vertical"> |
||||
<Setter Property="MinWidth" Value="20"/> |
<Setter Property="Background" Value="{DynamicResource SliderTrackFill}" /> |
||||
<Setter Property="MinHeight" Value="40"/> |
<Setter Property="BorderThickness" Value="{DynamicResource SliderBorderThemeThickness}" /> |
||||
|
<Setter Property="Foreground" Value="{DynamicResource SliderTrackValueFill}" /> |
||||
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<Grid> |
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{DynamicResource ControlCornerRadius}"> |
||||
<Grid.ColumnDefinitions> |
<Grid Name="grid" Margin="{TemplateBinding Padding}" RowDefinitions="Auto, *"> |
||||
<ColumnDefinition Width="Auto"/> |
<ContentPresenter x:Name="HeaderContentPresenter" Grid.Row="0" TextBlock.FontWeight="{DynamicResource SliderHeaderThemeFontWeight}" TextBlock.Foreground="{DynamicResource SliderHeaderForeground}" |
||||
<ColumnDefinition Width="Auto" MinWidth="26"/> |
Margin="{DynamicResource SliderTopHeaderMargin}" /> |
||||
<ColumnDefinition Width="Auto"/> |
<Grid x:Name="SliderContainer" Grid.Row="1"> |
||||
</Grid.ColumnDefinitions> |
<Grid.Styles> |
||||
<Border Name="TrackBackground" Grid.Column="1" Width="4" Margin="0,6" HorizontalAlignment="Center"/> |
<Style Selector="TickBar"> |
||||
<Track Name="PART_Track" Grid.Column="1" Orientation="Vertical" IsDirectionReversed="True"> |
<Setter Property="ReservedSpace" Value="{Binding #PART_Track.Thumb.Bounds}" /> |
||||
<Track.DecreaseButton> |
</Style> |
||||
<RepeatButton Name="PART_DecreaseButton" |
</Grid.Styles> |
||||
Classes="repeattrack" /> |
<Grid x:Name="VerticalTemplate" RowDefinitions="*,Auto,Auto" MinWidth="{DynamicResource SliderVerticalWidth}"> |
||||
</Track.DecreaseButton> |
<Grid.ColumnDefinitions> |
||||
<Track.IncreaseButton> |
<ColumnDefinition Width="{DynamicResource SliderPreContentMargin}" /> |
||||
<RepeatButton Name="PART_IncreaseButton" |
<ColumnDefinition Width="Auto" /> |
||||
Classes="repeattrack" /> |
<ColumnDefinition Width="{DynamicResource SliderPostContentMargin}" /> |
||||
</Track.IncreaseButton> |
</Grid.ColumnDefinitions> |
||||
<Thumb Name="thumb" MinWidth="20" MinHeight="20"> |
<TickBar Name="LeftTickBar" Placement="Left" Width="{DynamicResource SliderOutsideTickBarThemeHeight}" HorizontalAlignment="Right" Margin="0,0,4,0" Grid.RowSpan="3" /> |
||||
<Thumb.Template> |
<!-- <TickBar Name="VerticalInlineTickBar" Placement="Inline" Fill="{DynamicResource SliderInlineTickBarFill}" Width="{DynamicResource SliderTrackThemeHeight}" Grid.Column="1" Grid.RowSpan="3" /> --> |
||||
<ControlTemplate> |
<TickBar Name="RightTickBar" Placement="Right" Width="{DynamicResource SliderOutsideTickBarThemeHeight}" HorizontalAlignment="Left" Margin="4,0,0,0" Grid.Column="2" Grid.RowSpan="3" /> |
||||
<Grid> |
<Track Name="PART_Track" Grid.Column="1" Grid.ColumnSpan="1" Grid.RowSpan="3" Orientation="Vertical"> |
||||
<Ellipse Width="12" Height="12" Fill="{DynamicResource ThemeAccentBrush}"/> |
<Track.DecreaseButton> |
||||
</Grid> |
<RepeatButton Name="PART_DecreaseButton" Background="{TemplateBinding Foreground}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> |
||||
</ControlTemplate> |
<RepeatButton.Template> |
||||
</Thumb.Template> |
<ControlTemplate> |
||||
</Thumb> |
<Grid> |
||||
</Track> |
<Border Name="FocusTarget" Background="Transparent" Margin="0,-10" /> |
||||
</Grid> |
<Border Name="TrackBackground" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}" Width="{DynamicResource SliderTrackThemeHeight}" HorizontalAlignment="Center" /> |
||||
|
</Grid> |
||||
|
</ControlTemplate> |
||||
|
</RepeatButton.Template> |
||||
|
</RepeatButton> |
||||
|
</Track.DecreaseButton> |
||||
|
<Track.IncreaseButton> |
||||
|
<RepeatButton Name="PART_IncreaseButton" Background="{TemplateBinding Background}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> |
||||
|
<RepeatButton.Template> |
||||
|
<ControlTemplate> |
||||
|
<Grid> |
||||
|
<Border Name="FocusTarget" Background="Transparent" Margin="0,-10" /> |
||||
|
<Border Name="TrackBackground" Background="{TemplateBinding Background}" CornerRadius="{DynamicResource ControlCornerRadius}" Width="{DynamicResource SliderTrackThemeHeight}" HorizontalAlignment="Center" /> |
||||
|
</Grid> |
||||
|
</ControlTemplate> |
||||
|
</RepeatButton.Template> |
||||
|
</RepeatButton> |
||||
|
</Track.IncreaseButton> |
||||
|
<Thumb Classes="SliderThumbStyle" Name="SliderThumb" Margin="0" Padding="0" DataContext="{TemplateBinding Value}" Height="{DynamicResource SliderVerticalThumbHeight}" Width="{DynamicResource SliderVerticalThumbWidth}" /> |
||||
|
</Track> |
||||
|
</Grid> |
||||
|
</Grid> |
||||
|
</Grid> |
||||
|
</Border> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="Slider /template/ Track#PART_Track"> |
<Style Selector="Slider /template/ Track#PART_Track"> |
||||
<Setter Property="Minimum" Value="{TemplateBinding Minimum}"/> |
<Setter Property="Minimum" Value="{TemplateBinding Minimum}" /> |
||||
<Setter Property="Maximum" Value="{TemplateBinding Maximum}"/> |
<Setter Property="Maximum" Value="{TemplateBinding Maximum}" /> |
||||
<Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}"/> |
<Setter Property="Value" Value="{TemplateBinding Value, Mode=TwoWay}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="Slider /template/ Border#TrackBackground"> |
<Style Selector="Slider /template/ TickBar"> |
||||
<Setter Property="BorderThickness" Value="2"/> |
<Setter Property="Fill" Value="{DynamicResource SliderTickBarFill}" /> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}"/> |
<Setter Property="TickFrequency" Value="{TemplateBinding Slider.TickFrequency}" /> |
||||
|
<Setter Property="Orientation" Value="{TemplateBinding Slider.Orientation}" /> |
||||
|
<Setter Property="Minimum" Value="{TemplateBinding Slider.Minimum}" /> |
||||
|
<Setter Property="Maximum" Value="{TemplateBinding Slider.Maximum}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="Slider /template/ RepeatButton.repeattrack"> |
|
||||
<Setter Property="Background" Value="Transparent"/> |
<!-- Normal State --> |
||||
<Setter Property="Foreground" Value="{DynamicResource ThemeBorderLowBrush}"/> |
|
||||
<Setter Property="Template"> |
<Style Selector="Slider /template/ Thumb.SliderThumbStyle"> |
||||
<ControlTemplate> |
<Setter Property="Background" Value="{DynamicResource SliderThumbBackground}" /> |
||||
<Border Background="{TemplateBinding Background}" /> |
</Style> |
||||
</ControlTemplate> |
|
||||
</Setter> |
<Style Selector="Slider /template/ Grid#SliderContainer"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderContainerBackground}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider /template/ TickBar"> |
||||
|
<Setter Property="IsVisible" Value="False" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- TickBar Placement States --> |
||||
|
|
||||
|
<Style Selector="Slider[TickPlacement=TopLeft] /template/ TickBar#LeftTickBar, Slider[TickPlacement=Outside] /template/ TickBar#LeftTickBar"> |
||||
|
<Setter Property="IsVisible" Value="True" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider[TickPlacement=TopLeft] /template/ TickBar#TopTickBar, Slider[TickPlacement=Outside] /template/ TickBar#TopTickBar"> |
||||
|
<Setter Property="IsVisible" Value="True" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider[TickPlacement=BottomRight] /template/ TickBar#BottomTickBar, Slider[TickPlacement=Outside] /template/ TickBar#BottomTickBar"> |
||||
|
<Setter Property="IsVisible" Value="True" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider[TickPlacement=BottomRight] /template/ TickBar#RightTickBar, Slider[TickPlacement=Outside] /template/ TickBar#RightTickBar"> |
||||
|
<Setter Property="IsVisible" Value="True" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Disabled State --> |
||||
|
|
||||
|
<Style Selector="Slider:disabled /template/ ContentPresenter#HeaderContentPresenter"> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource SliderHeaderForegroundDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:disabled /template/ RepeatButton#PART_DecreaseButton"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderTrackValueFillDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:disabled /template/ RepeatButton#PART_IncreaseButton"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderTrackFillDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:disabled /template/ Thumb.SliderThumbStyle"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderThumbBackgroundDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:disabled /template/ TickBar"> |
||||
|
<Setter Property="Fill" Value="{DynamicResource SliderTickBarFillDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pointerover /template/ Grid#SliderContainer"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderContainerBackgroundDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- PointerOver State --> |
||||
|
<Style Selector="Slider:pointerover /template/ RepeatButton#PART_IncreaseButton"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderTrackFillPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pointerover /template/ Thumb.SliderThumbStyle"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderThumbBackgroundPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pointerover /template/ Grid#SliderContainer"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderContainerBackgroundPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pointerover /template/ RepeatButton#PART_DecreaseButton"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderTrackValueFillPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<!-- Pressed State --> |
||||
|
<Style Selector="Slider:pressed /template/ RepeatButton#PART_IncreaseButton"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderTrackFillPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pressed /template/ Thumb.SliderThumbStyle"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderThumbBackgroundPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pointerover /template/ Grid#SliderContainer"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderContainerBackgroundPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="Slider:pointerover /template/ RepeatButton#PART_DecreaseButton"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SliderTrackValueFillPressed}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="Slider:disabled /template/ Grid#grid"> |
|
||||
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> |
|
||||
</Style> |
|
||||
</Styles> |
</Styles> |
||||
|
|||||
@ -1,38 +1,108 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui"> |
<Styles xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
<Design.PreviewWith> |
||||
|
<Border Padding="20"> |
||||
|
<StackPanel Spacing="20"> |
||||
|
<ToggleButton Content="Click Me!" /> |
||||
|
<ToggleButton Content="Disabled" IsEnabled="False" /> |
||||
|
<ToggleButton Content="Three state" IsThreeState="True" /> |
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
</Design.PreviewWith> |
||||
|
|
||||
|
<Styles.Resources> |
||||
|
<Thickness x:Key="ButtonPadding">8,5,8,6</Thickness> |
||||
|
</Styles.Resources> |
||||
<Style Selector="ToggleButton"> |
<Style Selector="ToggleButton"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}"/> |
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackground}" /> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderLowBrush}"/> |
<Setter Property="Foreground" Value="{DynamicResource ToggleButtonForeground}" /> |
||||
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> |
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrush}" /> |
||||
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> |
<Setter Property="BorderThickness" Value="{DynamicResource ToggleButtonBorderThemeThickness}" /> |
||||
<Setter Property="Padding" Value="4"/> |
<Setter Property="Padding" Value="{DynamicResource ButtonPadding}" /> |
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/> |
<Setter Property="HorizontalAlignment" Value="Left" /> |
||||
<Setter Property="VerticalContentAlignment" Value="Center"/> |
<Setter Property="VerticalAlignment" Value="Center" /> |
||||
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
|
<Setter Property="FontWeight" Value="Normal" /> |
||||
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> |
||||
<Setter Property="Template"> |
<Setter Property="Template"> |
||||
<ControlTemplate> |
<ControlTemplate> |
||||
<ContentPresenter Name="PART_ContentPresenter" |
<ContentPresenter x:Name="PART_ContentPresenter" |
||||
Background="{TemplateBinding Background}" |
Background="{TemplateBinding Background}" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
BorderBrush="{TemplateBinding BorderBrush}" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
CornerRadius="{DynamicResource ControlCornerRadius}" |
||||
Content="{TemplateBinding Content}" |
Content="{TemplateBinding Content}" |
||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" |
||||
Padding="{TemplateBinding Padding}" |
Padding="{TemplateBinding Padding}" |
||||
TextBlock.Foreground="{TemplateBinding Foreground}" |
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/> |
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> |
||||
</ControlTemplate> |
</ControlTemplate> |
||||
</Setter> |
</Setter> |
||||
</Style> |
</Style> |
||||
<Style Selector="ToggleButton:checked /template/ ContentPresenter"> |
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> |
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
|
||||
</Style> |
|
||||
<Style Selector="ToggleButton:pointerover /template/ ContentPresenter"> |
<Style Selector="ToggleButton:pointerover /template/ ContentPresenter"> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundPointerOver}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushPointerOver}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundPointerOver}" /> |
||||
</Style> |
</Style> |
||||
|
|
||||
<Style Selector="ToggleButton:pressed /template/ ContentPresenter"> |
<Style Selector="ToggleButton:pressed /template/ ContentPresenter"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeControlHighBrush}"/> |
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundPressed}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushPressed}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:disabled /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundDisabled}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushDisabled}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:checked /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundChecked}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushChecked}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundChecked}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:checked:pointerover /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedPointerOver}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedPointerOver}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedPointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:checked:pressed /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedPressed}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedPressed}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedPressed}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:checked:disabled /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundCheckedDisabled}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushCheckedDisabled}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundCheckedDisabled}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:indeterminate /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminate}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminate}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminate}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:indeterminate:pointerover /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminatePointerOver}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminatePointerOver}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminatePointerOver}" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToggleButton:indeterminate:pressed /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminatePressed}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminatePressed}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminatePressed}" /> |
||||
</Style> |
</Style> |
||||
<Style Selector="ToggleButton:disabled"> |
|
||||
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}"/> |
<Style Selector="ToggleButton:indeterminate:disabled /template/ ContentPresenter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToggleButtonBackgroundIndeterminateDisabled}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToggleButtonBorderBrushIndeterminateDisabled}" /> |
||||
|
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ToggleButtonForegroundIndeterminateDisabled}" /> |
||||
</Style> |
</Style> |
||||
</Styles> |
</Styles> |
||||
|
|||||
@ -1,17 +1,78 @@ |
|||||
<Style xmlns="https://github.com/avaloniaui" Selector="ToolTip"> |
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> |
<Design.PreviewWith> |
||||
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> |
<Grid RowDefinitions="Auto,Auto" |
||||
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> |
ColumnDefinitions="Auto,Auto" |
||||
<Setter Property="Padding" Value="4,2"/> |
HorizontalAlignment="Center"> |
||||
<Setter Property="Template"> |
<Border Grid.Column="0" |
||||
<ControlTemplate> |
Grid.Row="1" |
||||
<ContentPresenter Name="PART_ContentPresenter" |
Background="{DynamicResource ThemeAccentBrush}" |
||||
Background="{TemplateBinding Background}" |
Margin="5" |
||||
BorderBrush="{TemplateBinding BorderBrush}" |
Padding="50" |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
ToolTip.Tip="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."> |
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
<TextBlock>Hover Here</TextBlock> |
||||
Content="{TemplateBinding Content}" |
</Border> |
||||
Padding="{TemplateBinding Padding}"/> |
<CheckBox Grid.Column="1" |
||||
</ControlTemplate> |
Margin="5" |
||||
</Setter> |
Grid.Row="0" |
||||
</Style> |
IsChecked="{Binding ElementName=Border, Path=(ToolTip.IsOpen)}" |
||||
|
Content="ToolTip Open" /> |
||||
|
<Border Name="Border" |
||||
|
Grid.Column="1" |
||||
|
Grid.Row="1" |
||||
|
Background="{DynamicResource ThemeAccentBrush}" |
||||
|
Margin="5" |
||||
|
Padding="50" |
||||
|
ToolTip.Placement="Bottom"> |
||||
|
<ToolTip.Tip> |
||||
|
<StackPanel> |
||||
|
<TextBlock Classes="h1">ToolTip</TextBlock> |
||||
|
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
||||
|
</StackPanel> |
||||
|
</ToolTip.Tip> |
||||
|
<TextBlock>ToolTip bottom placement</TextBlock> |
||||
|
</Border> |
||||
|
</Grid> |
||||
|
</Design.PreviewWith> |
||||
|
|
||||
|
<Style Selector="ToolTip"> |
||||
|
<Setter Property="Foreground" Value="{DynamicResource ToolTipForeground}" /> |
||||
|
<Setter Property="Background" Value="{DynamicResource ToolTipBackground}" /> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource ToolTipBorderBrush}" /> |
||||
|
<Setter Property="BorderThickness" Value="{DynamicResource ToolTipBorderThemeThickness}" /> |
||||
|
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" /> |
||||
|
<Setter Property="FontSize" Value="{DynamicResource ToolTipContentThemeFontSize}" /> |
||||
|
<Setter Property="Padding" Value="{DynamicResource ToolTipBorderThemePadding}" /> |
||||
|
<Setter Property="Transitions"> |
||||
|
<Transitions> |
||||
|
<DoubleTransition Property="Opacity" Duration="0:0:0.15" /> |
||||
|
</Transitions> |
||||
|
</Setter> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<Border Name="PART_LayoutRoot" |
||||
|
BorderThickness="{TemplateBinding BorderThickness}" |
||||
|
Background="{TemplateBinding Background}" |
||||
|
BorderBrush="{TemplateBinding BorderBrush}" |
||||
|
Padding="{TemplateBinding Padding}" |
||||
|
CornerRadius="{DynamicResource OverlayCornerRadius}"> |
||||
|
<ContentPresenter Name="PART_ContentPresenter" |
||||
|
MaxWidth="320" |
||||
|
Content="{TemplateBinding Content}" |
||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" /> |
||||
|
</Border> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToolTip > TextBlock"> |
||||
|
<Setter Property="TextWrapping" Value="Wrap" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToolTip"> |
||||
|
<Setter Property="Opacity" Value="0" /> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="ToolTip:open"> |
||||
|
<Setter Property="Opacity" Value="1" /> |
||||
|
</Style> |
||||
|
</Styles> |
||||
|
|||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue