From 89fa3b77f5ae91e6c9dba253fef5ac7482850a3d Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 21 May 2020 11:36:03 +0200 Subject: [PATCH 01/48] Added nullable annotations to ContextMenu. --- src/Avalonia.Controls/ContextMenu.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Controls/ContextMenu.cs b/src/Avalonia.Controls/ContextMenu.cs index 86499530da..a026c8fa72 100644 --- a/src/Avalonia.Controls/ContextMenu.cs +++ b/src/Avalonia.Controls/ContextMenu.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using Avalonia.Controls.Generators; using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; @@ -9,9 +8,10 @@ using Avalonia.Controls.Templates; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Layout; -using Avalonia.LogicalTree; using Avalonia.Styling; +#nullable enable + namespace Avalonia.Controls { /// @@ -21,9 +21,9 @@ namespace Avalonia.Controls { private static readonly ITemplate DefaultPanel = new FuncTemplate(() => new StackPanel { Orientation = Orientation.Vertical }); - private Popup _popup; - private List _attachedControls; - private IInputElement _previousFocus; + private Popup? _popup; + private List? _attachedControls; + private IInputElement? _previousFocus; /// /// Initializes a new instance of the class. @@ -56,14 +56,14 @@ namespace Avalonia.Controls /// /// property is changing from false to true. /// - public event CancelEventHandler ContextMenuOpening; + public event CancelEventHandler? ContextMenuOpening; /// /// Occurs when the value of the /// /// property is changing from true to false. /// - public event CancelEventHandler ContextMenuClosing; + public event CancelEventHandler? ContextMenuClosing; /// /// Called when the property changes on a control. @@ -77,7 +77,7 @@ namespace Avalonia.Controls { control.PointerReleased -= ControlPointerReleased; oldMenu._attachedControls?.Remove(control); - ((ISetLogicalParent)oldMenu._popup)?.SetParent(null); + ((ISetLogicalParent?)oldMenu._popup)?.SetParent(null); } if (e.NewValue is ContextMenu newMenu) @@ -97,7 +97,7 @@ namespace Avalonia.Controls /// Opens a context menu on the specified control. /// /// The control. - public void Open(Control control) + public void Open(Control? control) { if (control is null && (_attachedControls is null || _attachedControls.Count == 0)) { @@ -113,7 +113,7 @@ namespace Avalonia.Controls nameof(control)); } - control ??= _attachedControls[0]; + control ??= _attachedControls![0]; if (IsOpen) { @@ -204,7 +204,7 @@ namespace Avalonia.Controls if (_attachedControls is null || _attachedControls.Count == 0) { - ((ISetLogicalParent)_popup).SetParent(null); + ((ISetLogicalParent)_popup!).SetParent(null); } // HACK: Reset the focus when the popup is closed. We need to fix this so it's automatic. From 372042b6f9afb67ec2934f5a76dd3f6442bad1fa Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 21 May 2020 11:39:12 +0200 Subject: [PATCH 02/48] Added positioning properties to ContextMenu. --- src/Avalonia.Controls/ContextMenu.cs | 69 ++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/ContextMenu.cs b/src/Avalonia.Controls/ContextMenu.cs index a026c8fa72..5a60fd37af 100644 --- a/src/Avalonia.Controls/ContextMenu.cs +++ b/src/Avalonia.Controls/ContextMenu.cs @@ -19,6 +19,30 @@ namespace Avalonia.Controls /// public class ContextMenu : MenuBase, ISetterValue { + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementModeProperty = + Popup.PlacementModeProperty.AddOwner(); + + /// + /// Defines the property. + /// + public static readonly StyledProperty HorizontalOffsetProperty = + Popup.HorizontalOffsetProperty.AddOwner(); + + /// + /// Defines the property. + /// + public static readonly StyledProperty VerticalOffsetProperty = + Popup.VerticalOffsetProperty.AddOwner(); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementTargetProperty = + Popup.PlacementTargetProperty.AddOwner(); + private static readonly ITemplate DefaultPanel = new FuncTemplate(() => new StackPanel { Orientation = Orientation.Vertical }); private Popup? _popup; @@ -47,10 +71,47 @@ namespace Avalonia.Controls /// static ContextMenu() { - ItemsPanelProperty.OverrideDefaultValue(typeof(ContextMenu), DefaultPanel); + ItemsPanelProperty.OverrideDefaultValue(DefaultPanel); + PlacementModeProperty.OverrideDefaultValue(PlacementMode.Pointer); ContextMenuProperty.Changed.Subscribe(ContextMenuChanged); } + /// + /// Gets or sets the placement mode of the popup in relation to the . + /// + public PlacementMode PlacementMode + { + get { return GetValue(PlacementModeProperty); } + set { SetValue(PlacementModeProperty, value); } + } + + /// + /// Gets or sets the Horizontal offset of the popup in relation to the + /// + public double HorizontalOffset + { + get { return GetValue(HorizontalOffsetProperty); } + set { SetValue(HorizontalOffsetProperty, value); } + } + + /// + /// Gets or sets the Vertical offset of the popup in relation to the + /// + public double VerticalOffset + { + get { return GetValue(VerticalOffsetProperty); } + set { SetValue(VerticalOffsetProperty, value); } + } + + /// + /// Gets or sets the control that is used to determine the popup's position. + /// + public Control? PlacementTarget + { + get { return GetValue(PlacementTargetProperty); } + set { SetValue(PlacementTargetProperty, value); } + } + /// /// Occurs when the value of the /// @@ -124,8 +185,10 @@ namespace Avalonia.Controls { _popup = new Popup { - PlacementMode = PlacementMode.Pointer, - PlacementTarget = control, + HorizontalOffset = HorizontalOffset, + VerticalOffset = VerticalOffset, + PlacementMode = PlacementMode, + PlacementTarget = PlacementTarget ?? control, StaysOpen = false }; From 9bb71a248467f2827518b652797441e647d7ed30 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 21 May 2020 14:46:49 +0200 Subject: [PATCH 03/48] Added/tweaked docs. --- .../Primitives/IPopupHost.cs | 46 +++ .../PopupPositioning/IPopupPositioner.cs | 269 +++++++++++------- .../ManagedPopupPositioner.cs | 4 + 3 files changed, 218 insertions(+), 101 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/IPopupHost.cs b/src/Avalonia.Controls/Primitives/IPopupHost.cs index 74a3ca8818..bb4daf38e1 100644 --- a/src/Avalonia.Controls/Primitives/IPopupHost.cs +++ b/src/Avalonia.Controls/Primitives/IPopupHost.cs @@ -5,19 +5,65 @@ using Avalonia.VisualTree; namespace Avalonia.Controls.Primitives { + /// + /// Represents the top-level control opened by a . + /// + /// + /// A popup host can be either be a popup window created by the operating system + /// () or an which is created + /// on an . + /// public interface IPopupHost : IDisposable { + /// + /// Sets the control to display in the popup. + /// + /// void SetChild(IControl control); + + /// + /// Gets the presenter from the control's template. + /// IContentPresenter Presenter { get; } + + /// + /// Gets the root of the visual tree in the case where the popup is presented using a + /// separate visual tree. + /// IVisual HostedVisualTreeRoot { get; } + /// + /// Raised when the control's template is applied. + /// event EventHandler TemplateApplied; + /// + /// Configures the position of the popup according to a target control and a set of + /// placement parameters. + /// + /// The placement target. + /// The placement mode. + /// The offset, in device-independent pixels. + /// The anchor point. + /// The anchor gravity. void ConfigurePosition(IVisual target, PlacementMode placement, Point offset, PopupPositioningEdge anchor = PopupPositioningEdge.None, PopupPositioningEdge gravity = PopupPositioningEdge.None); + + /// + /// Shows the popup. + /// void Show(); + + /// + /// Hides the popup. + /// void Hide(); + + /// + /// Binds the constraints of the popup host to a set of properties, usally those present on + /// . + /// IDisposable BindConstraints(AvaloniaObject popup, StyledProperty widthProperty, StyledProperty minWidthProperty, StyledProperty maxWidthProperty, StyledProperty heightProperty, StyledProperty minHeightProperty, diff --git a/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs b/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs index f0358ec04f..d2a403b602 100644 --- a/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs +++ b/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs @@ -50,45 +50,47 @@ using Avalonia.VisualTree; namespace Avalonia.Controls.Primitives.PopupPositioning { /// - /// - /// The IPopupPositioner provides a collection of rules for the placement of a - /// a popup relative to its parent. Rules can be defined to ensure - /// the popup remains within the visible area's borders, and to - /// specify how the popup changes its position, such as sliding along - /// an axis, or flipping around a rectangle. These positioner-created rules are - /// constrained by the requirement that a popup must intersect with or - /// be at least partially adjacent to its parent surface. + /// Provides positioning parameters to . /// + /// + /// The IPopupPositioner provides a collection of rules for the placement of a a popup relative + /// to its parent. Rules can be defined to ensure the popup remains within the visible area's + /// borders, and to specify how the popup changes its position, such as sliding along an axis, + /// or flipping around a rectangle. These positioner-created rules are constrained by the + /// requirement that a popup must intersect with or be at least partially adjacent to its parent + /// surface. + /// public struct PopupPositionerParameters { private PopupPositioningEdge _gravity; private PopupPositioningEdge _anchor; /// - /// Set the size of the popup that is to be positioned with the positioner - /// object. The size is in scaled coordinates. + /// Set the size of the popup that is to be positioned with the positioner object, in device- + /// independent pixels. /// public Size Size { get; set; } /// - /// Specify the anchor rectangle within the parent that the popup - /// will be placed relative to. The rectangle is relative to the - /// parent geometry - /// - /// The anchor rectangle may not extend outside the window geometry of the - /// popup's parent. The anchor rectangle is in scaled coordinates + /// Specifies the anchor rectangle within the parent that the popup will be placed relative + /// to, in device-independent pixels. /// + /// + /// The rectangle is relative to the parent geometry and may not extend outside the window + /// geometry of the popup's parent. + /// public Rect AnchorRectangle { get; set; } - /// - /// Defines the anchor point for the anchor rectangle. The specified anchor - /// is used derive an anchor point that the popup will be - /// positioned relative to. If a corner anchor is set (e.g. 'TopLeft' or - /// 'BottomRight'), the anchor point will be at the specified corner; - /// otherwise, the derived anchor point will be centered on the specified - /// edge, or in the center of the anchor rectangle if no edge is specified. + /// Defines the anchor point for the anchor rectangle. /// + /// + /// The specified anchor is used derive an anchor point that the popup will be positioned + /// relative to. If a corner anchor is set (e.g. 'TopLeft' or 'BottomRight'), the anchor + /// point will be at the specified corner; otherwise, the derived anchor point will be + /// centered on the specified edge, or in the center of the anchor rectangle if no edge is + /// specified. + /// public PopupPositioningEdge Anchor { get => _anchor; @@ -100,13 +102,14 @@ namespace Avalonia.Controls.Primitives.PopupPositioning } /// - /// Defines in what direction a popup should be positioned, relative to - /// the anchor point of the parent. If a corner gravity is - /// specified (e.g. 'BottomRight' or 'TopLeft'), then the popup - /// will be placed towards the specified gravity; otherwise, the popup - /// will be centered over the anchor point on any axis that had no - /// gravity specified. + /// Defines in what direction a popup should be positioned, relative to the anchor point of + /// the parent. /// + /// + /// If a corner gravity is specified (e.g. 'BottomRight' or 'TopLeft'), then the popup will + /// be placed towards the specified gravity; otherwise, the popup will be centered over the + /// anchor point on any axis that had no gravity specified. + /// public PopupPositioningEdge Gravity { get => _gravity; @@ -118,48 +121,51 @@ namespace Avalonia.Controls.Primitives.PopupPositioning } /// - /// Specify how the popup should be positioned if the originally intended - /// position caused the popup to be constrained, meaning at least - /// partially outside positioning boundaries set by the positioner. The - /// adjustment is set by constructing a bitmask describing the adjustment to - /// be made when the popup is constrained on that axis. + /// Specify how the popup should be positioned if the originally intended position caused + /// the popup to be constrained. + /// + /// + /// Adjusts the popup position if the intended position caused the popup to be constrained; + /// meaning at least partially outside positioning boundaries set by the positioner. The + /// adjustment is set by constructing a bitmask describing the adjustment to be made when + /// the popup is constrained on that axis. /// - /// If no bit for one axis is set, the positioner will assume that the child - /// surface should not change its position on that axis when constrained. + /// If no bit for one axis is set, the positioner will assume that the child surface should + /// not change its position on that axis when constrained. /// - /// If more than one bit for one axis is set, the order of how adjustments - /// are applied is specified in the corresponding adjustment descriptions. + /// If more than one bit for one axis is set, the order of how adjustments are applied is + /// specified in the corresponding adjustment descriptions. /// /// The default adjustment is none. - /// + /// public PopupPositionerConstraintAdjustment ConstraintAdjustment { get; set; } - + /// /// Specify the popup position offset relative to the position of the - /// anchor on the anchor rectangle and the anchor on the popup. For - /// example if the anchor of the anchor rectangle is at (x, y), the popup - /// has the gravity bottom|right, and the offset is (ox, oy), the calculated - /// surface position will be (x + ox, y + oy). The offset position of the - /// surface is the one used for constraint testing. See - /// set_constraint_adjustment. - /// - /// An example use case is placing a popup menu on top of a user interface - /// element, while aligning the user interface element of the parent surface - /// with some user interface element placed somewhere in the popup. + /// anchor on the anchor rectangle and the anchor on the popup. /// + /// + /// For example if the anchor of the anchor rectangle is at (x, y), the popup has the + /// gravity bottom|right, and the offset is (ox, oy), the calculated surface position will + /// be (x + ox, y + oy). The offset position of the surface is the one used for constraint + /// testing. See set_constraint_adjustment. + /// + /// An example use case is placing a popup menu on top of a user interface element, while + /// aligning the user interface element of the parent surface with some user interface + /// element placed somewhere in the popup. + /// public Point Offset { get; set; } } - + /// - /// The constraint adjustment value define ways how popup position will - /// be adjusted if the unadjusted position would result in the popup - /// being partly constrained. - /// - /// Whether a popup is considered 'constrained' is left to the positioner - /// to determine. For example, the popup may be partly outside the - /// target platform defined 'work area', thus necessitating the popup's - /// position be adjusted until it is entirely inside the work area. + /// Defines how a popup position will be adjusted if the unadjusted position would result in + /// the popup being partly constrained. /// + /// + /// Whether a popup is considered 'constrained' is left to the positioner to determine. For + /// example, the popup may be partly outside the target platform defined 'work area', thus + /// necessitating the popup's position be adjusted until it is entirely inside the work area. + /// [Flags] public enum PopupPositionerConstraintAdjustment { @@ -171,62 +177,59 @@ namespace Avalonia.Controls.Primitives.PopupPositioning /// /// Slide the surface along the x axis until it is no longer constrained. - /// First try to slide towards the direction of the gravity on the x axis - /// until either the edge in the opposite direction of the gravity is - /// unconstrained or the edge in the direction of the gravity is - /// constrained. - /// - /// Then try to slide towards the opposite direction of the gravity on the - /// x axis until either the edge in the direction of the gravity is - /// unconstrained or the edge in the opposite direction of the gravity is - /// constrained. /// + /// + /// First try to slide towards the direction of the gravity on the x axis until either the + /// edge in the opposite direction of the gravity is unconstrained or the edge in the + /// direction of the gravity is constrained. + /// + /// Then try to slide towards the opposite direction of the gravity on the x axis until + /// either the edge in the direction of the gravity is unconstrained or the edge in the + /// opposite direction of the gravity is constrained. + /// SlideX = 1, - /// - /// Slide the surface along the y axis until it is no longer constrained. - /// - /// First try to slide towards the direction of the gravity on the y axis - /// until either the edge in the opposite direction of the gravity is - /// unconstrained or the edge in the direction of the gravity is - /// constrained. - /// - /// Then try to slide towards the opposite direction of the gravity on the - /// y axis until either the edge in the direction of the gravity is - /// unconstrained or the edge in the opposite direction of the gravity is - /// constrained. - /// */ + /// Slide the surface along the y axis until it is no longer constrained. /// + /// + /// First try to slide towards the direction of the gravity on the y axis until either the + /// edge in the opposite direction of the gravity is unconstrained or the edge in the + /// direction of the gravity is constrained. + /// + /// Then try to slide towards the opposite direction of the gravity on the y axis until + /// either the edge in the direction of the gravity is unconstrained or the edge in the + /// opposite direction of the gravity is constrained. + /// SlideY = 2, /// - /// Invert the anchor and gravity on the x axis if the surface is - /// constrained on the x axis. For example, if the left edge of the - /// surface is constrained, the gravity is 'left' and the anchor is - /// 'left', change the gravity to 'right' and the anchor to 'right'. - /// - /// If the adjusted position also ends up being constrained, the resulting - /// position of the flip_x adjustment will be the one before the - /// adjustment. + /// Invert the anchor and gravity on the x axis if the surface is constrained on the x axis. /// + /// + /// For example, if the left edge of the surface is constrained, the gravity is 'left' and + /// the anchor is 'left', change the gravity to 'right' and the anchor to 'right'. + /// + /// If the adjusted position also ends up being constrained, the resulting position of the + /// FlipX adjustment will be the one before the adjustment. + /// /// FlipX = 4, /// - /// Invert the anchor and gravity on the y axis if the surface is - /// constrained on the y axis. For example, if the bottom edge of the - /// surface is constrained, the gravity is 'bottom' and the anchor is - /// 'bottom', change the gravity to 'top' and the anchor to 'top'. + /// Invert the anchor and gravity on the y axis if the surface is constrained on the y axis. + /// + /// + /// For example, if the bottom edge of the surface is constrained, the gravity is 'bottom' + /// and the anchor is 'bottom', change the gravity to 'top' and the anchor to 'top'. /// - /// The adjusted position is calculated given the original anchor - /// rectangle and offset, but with the new flipped anchor and gravity - /// values. + /// The adjusted position is calculated given the original anchor rectangle and offset, but + /// with the new flipped anchor and gravity values. /// - /// If the adjusted position also ends up being constrained, the resulting - /// position of the flip_y adjustment will be the one before the - /// adjustment. - /// + /// If the adjusted position also ends up being constrained, the resulting position of the + /// FlipY adjustment will be the one before the adjustment. + /// FlipY = 8, + All = SlideX|SlideY|FlipX|FlipY } @@ -267,27 +270,91 @@ namespace Avalonia.Controls.Primitives.PopupPositioning } + /// + /// Defines the popup position edge for and + /// . + /// [Flags] public enum PopupPositioningEdge { + /// + /// The center of the anchor rectangle. + /// None, + + /// + /// The top edge of the anchor rectangle. + /// Top = 1, + + /// + /// The bottom edge of the anchor rectangle. + /// Bottom = 2, + + /// + /// The left edge of the anchor rectangle. + /// Left = 4, + + /// + /// The right edge of the anchor rectangle. + /// Right = 8, + + /// + /// The top-left corner of the anchor rectangle. + /// TopLeft = Top | Left, + + /// + /// The top-right corner of the anchor rectangle. + /// TopRight = Top | Right, + + /// + /// The bottom-left corner of the anchor rectangle. + /// BottomLeft = Bottom | Left, + + /// + /// The bottom-right corner of the anchor rectangle. + /// BottomRight = Bottom | Right, - + /// + /// A mask for the vertical component flags. + /// VerticalMask = Top | Bottom, + + /// + /// A mask for the horizontal component flags. + /// HorizontalMask = Left | Right, + + /// + /// A mask for all flags. + /// AllMask = VerticalMask|HorizontalMask } + /// + /// Positions an . + /// + /// + /// is an abstraction of the wayland xdg_positioner spec. + /// + /// The popup positioner implementation is determined by the platform implementation. A default + /// managed implementation is provided in for platforms + /// on which popups can be arbitrarily positioned. + /// public interface IPopupPositioner { + /// + /// Updates the position of the associated according to the + /// specified parameters. + /// + /// The positioning parameters. void Update(PopupPositionerParameters parameters); } diff --git a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs index 07348cdf78..bd23a13e7f 100644 --- a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs +++ b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs @@ -25,6 +25,10 @@ namespace Avalonia.Controls.Primitives.PopupPositioning } } + /// + /// An implementation for platforms on which a popup can be + /// aritrarily positioned. + /// public class ManagedPopupPositioner : IPopupPositioner { private readonly IManagedPopupPositionerPopup _popup; From 07d1f16fa0f7eeb58c35c9977bab06f4c9a6fa15 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 21 May 2020 15:35:25 +0200 Subject: [PATCH 04/48] Added additional placement properties to PopupRoot. And split `PopupPositioningEdge` into `PopupAnchor` and `PopupGravity` so their values can be documented more clearly. --- .../Primitives/IPopupHost.cs | 10 +- .../Primitives/OverlayPopupHost.cs | 5 +- src/Avalonia.Controls/Primitives/Popup.cs | 97 +++++++++--- .../PopupPositioning/IPopupPositioner.cs | 138 +++++++++++++----- .../ManagedPopupPositioner.cs | 42 +++--- src/Avalonia.Controls/Primitives/PopupRoot.cs | 7 +- 6 files changed, 215 insertions(+), 84 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/IPopupHost.cs b/src/Avalonia.Controls/Primitives/IPopupHost.cs index bb4daf38e1..18fb45fd5a 100644 --- a/src/Avalonia.Controls/Primitives/IPopupHost.cs +++ b/src/Avalonia.Controls/Primitives/IPopupHost.cs @@ -45,10 +45,14 @@ namespace Avalonia.Controls.Primitives /// The placement mode. /// The offset, in device-independent pixels. /// The anchor point. - /// The anchor gravity. + /// The popup gravity. + /// + /// The anchor rect. If null, the bounds of will be used. + /// void ConfigurePosition(IVisual target, PlacementMode placement, Point offset, - PopupPositioningEdge anchor = PopupPositioningEdge.None, - PopupPositioningEdge gravity = PopupPositioningEdge.None); + PopupAnchor anchor = PopupAnchor.None, + PopupGravity gravity = PopupGravity.None, + Rect? rect = null); /// /// Shows the popup. diff --git a/src/Avalonia.Controls/Primitives/OverlayPopupHost.cs b/src/Avalonia.Controls/Primitives/OverlayPopupHost.cs index 3dc9d302db..15b09f29f1 100644 --- a/src/Avalonia.Controls/Primitives/OverlayPopupHost.cs +++ b/src/Avalonia.Controls/Primitives/OverlayPopupHost.cs @@ -71,10 +71,11 @@ namespace Avalonia.Controls.Primitives } public void ConfigurePosition(IVisual target, PlacementMode placement, Point offset, - PopupPositioningEdge anchor = PopupPositioningEdge.None, PopupPositioningEdge gravity = PopupPositioningEdge.None) + PopupAnchor anchor = PopupAnchor.None, PopupGravity gravity = PopupGravity.None, + Rect? rect = null) { _positionerParameters.ConfigurePosition((TopLevel)_overlayLayer.GetVisualRoot(), target, placement, offset, anchor, - gravity); + gravity, rect); UpdatePosition(); } diff --git a/src/Avalonia.Controls/Primitives/Popup.cs b/src/Avalonia.Controls/Primitives/Popup.cs index 66f2153b6c..ff1201286c 100644 --- a/src/Avalonia.Controls/Primitives/Popup.cs +++ b/src/Avalonia.Controls/Primitives/Popup.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Linq; using System.Reactive.Disposables; using Avalonia.Controls.Presenters; +using Avalonia.Controls.Primitives.PopupPositioning; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Interactivity; @@ -34,12 +35,36 @@ namespace Avalonia.Controls.Primitives o => o.IsOpen, (o, v) => o.IsOpen = v); + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementAnchorProperty = + AvaloniaProperty.Register(nameof(PlacementAnchor)); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementGravityProperty = + AvaloniaProperty.Register(nameof(PlacementGravity)); + /// /// Defines the property. /// public static readonly StyledProperty PlacementModeProperty = AvaloniaProperty.Register(nameof(PlacementMode), defaultValue: PlacementMode.Bottom); + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementRectProperty = + AvaloniaProperty.Register(nameof(PlacementRect)); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementTargetProperty = + AvaloniaProperty.Register(nameof(PlacementTarget)); + #pragma warning disable 618 /// /// Defines the property. @@ -60,12 +85,6 @@ namespace Avalonia.Controls.Primitives public static readonly StyledProperty VerticalOffsetProperty = AvaloniaProperty.Register(nameof(VerticalOffset)); - /// - /// Defines the property. - /// - public static readonly StyledProperty PlacementTargetProperty = - AvaloniaProperty.Register(nameof(PlacementTarget)); - /// /// Defines the property. /// @@ -136,6 +155,26 @@ namespace Avalonia.Controls.Primitives set { SetAndRaise(IsOpenProperty, ref _isOpen, value); } } + /// + /// Gets or sets the anchor point on the when + /// is . + /// + public PopupAnchor PlacementAnchor + { + get { return GetValue(PlacementAnchorProperty); } + set { SetValue(PlacementAnchorProperty, value); } + } + + /// + /// Gets or sets a value which defines in what direction the popup should open + /// when is . + /// + public PopupGravity PlacementGravity + { + get { return GetValue(PlacementGravityProperty); } + set { SetValue(PlacementGravityProperty, value); } + } + /// /// Gets or sets the placement mode of the popup in relation to the . /// @@ -145,6 +184,32 @@ namespace Avalonia.Controls.Primitives set { SetValue(PlacementModeProperty, value); } } + /// + /// Gets or sets the the anchor rectangle within the parent that the popup will be placed + /// relative to when is . + /// + /// + /// The placement rect defines a rectangle relative to around + /// which the popup will be opened, with determining which edge + /// of the placement target is used. + /// + /// If unset, the anchor rectangle will be the bounds of the . + /// + public Rect? PlacementRect + { + get { return GetValue(PlacementRectProperty); } + set { SetValue(PlacementRectProperty, value); } + } + + /// + /// Gets or sets the control that is used to determine the popup's position. + /// + public Control? PlacementTarget + { + get { return GetValue(PlacementTargetProperty); } + set { SetValue(PlacementTargetProperty, value); } + } + [Obsolete("This property has no effect")] public bool ObeyScreenEdges { @@ -153,7 +218,7 @@ namespace Avalonia.Controls.Primitives } /// - /// Gets or sets the Horizontal offset of the popup in relation to the + /// Gets or sets the Horizontal offset of the popup in relation to the . /// public double HorizontalOffset { @@ -162,7 +227,7 @@ namespace Avalonia.Controls.Primitives } /// - /// Gets or sets the Vertical offset of the popup in relation to the + /// Gets or sets the Vertical offset of the popup in relation to the . /// public double VerticalOffset { @@ -170,15 +235,6 @@ namespace Avalonia.Controls.Primitives set { SetValue(VerticalOffsetProperty, value); } } - /// - /// Gets or sets the control that is used to determine the popup's position. - /// - public Control? PlacementTarget - { - get { return GetValue(PlacementTargetProperty); } - set { SetValue(PlacementTargetProperty, value); } - } - /// /// Gets or sets a value indicating whether the popup should stay open when the popup is /// pressed or loses focus. @@ -251,8 +307,11 @@ namespace Avalonia.Controls.Primitives popupHost.ConfigurePosition( placementTarget, - PlacementMode, - new Point(HorizontalOffset, VerticalOffset)); + PlacementMode, + new Point(HorizontalOffset, VerticalOffset), + PlacementAnchor, + PlacementGravity, + PlacementRect); DeferCleanup(SubscribeToEventHandler>(popupHost, RootTemplateApplied, (x, handler) => x.TemplateApplied += handler, diff --git a/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs b/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs index d2a403b602..d6e54b80c1 100644 --- a/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs +++ b/src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs @@ -62,8 +62,8 @@ namespace Avalonia.Controls.Primitives.PopupPositioning /// public struct PopupPositionerParameters { - private PopupPositioningEdge _gravity; - private PopupPositioningEdge _anchor; + private PopupGravity _gravity; + private PopupAnchor _anchor; /// /// Set the size of the popup that is to be positioned with the positioner object, in device- @@ -91,7 +91,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning /// centered on the specified edge, or in the center of the anchor rectangle if no edge is /// specified. /// - public PopupPositioningEdge Anchor + public PopupAnchor Anchor { get => _anchor; set @@ -110,12 +110,12 @@ namespace Avalonia.Controls.Primitives.PopupPositioning /// be placed towards the specified gravity; otherwise, the popup will be centered over the /// anchor point on any axis that had no gravity specified. /// - public PopupPositioningEdge Gravity + public PopupGravity Gravity { get => _gravity; set { - PopupPositioningEdgeHelper.ValidateEdge(value); + PopupPositioningEdgeHelper.ValidateGravity(value); _gravity = value; } } @@ -235,18 +235,23 @@ namespace Avalonia.Controls.Primitives.PopupPositioning static class PopupPositioningEdgeHelper { - public static void ValidateEdge(this PopupPositioningEdge edge) + public static void ValidateEdge(this PopupAnchor edge) { - if (((edge & PopupPositioningEdge.Left) != 0 && (edge & PopupPositioningEdge.Right) != 0) + if (((edge & PopupAnchor.Left) != 0 && (edge & PopupAnchor.Right) != 0) || - ((edge & PopupPositioningEdge.Top) != 0 && (edge & PopupPositioningEdge.Bottom) != 0)) + ((edge & PopupAnchor.Top) != 0 && (edge & PopupAnchor.Bottom) != 0)) throw new ArgumentException("Opposite edges specified"); } - public static PopupPositioningEdge Flip(this PopupPositioningEdge edge) + public static void ValidateGravity(this PopupGravity gravity) + { + ValidateEdge((PopupAnchor)gravity); + } + + public static PopupAnchor Flip(this PopupAnchor edge) { - var hmask = PopupPositioningEdge.Left | PopupPositioningEdge.Right; - var vmask = PopupPositioningEdge.Top | PopupPositioningEdge.Bottom; + var hmask = PopupAnchor.Left | PopupAnchor.Right; + var vmask = PopupAnchor.Top | PopupAnchor.Bottom; if ((edge & hmask) != 0) edge ^= hmask; if ((edge & vmask) != 0) @@ -254,28 +259,36 @@ namespace Avalonia.Controls.Primitives.PopupPositioning return edge; } - public static PopupPositioningEdge FlipX(this PopupPositioningEdge edge) + public static PopupAnchor FlipX(this PopupAnchor edge) { - if ((edge & PopupPositioningEdge.HorizontalMask) != 0) - edge ^= PopupPositioningEdge.HorizontalMask; + if ((edge & PopupAnchor.HorizontalMask) != 0) + edge ^= PopupAnchor.HorizontalMask; return edge; } - public static PopupPositioningEdge FlipY(this PopupPositioningEdge edge) + public static PopupAnchor FlipY(this PopupAnchor edge) { - if ((edge & PopupPositioningEdge.VerticalMask) != 0) - edge ^= PopupPositioningEdge.VerticalMask; + if ((edge & PopupAnchor.VerticalMask) != 0) + edge ^= PopupAnchor.VerticalMask; return edge; } - + + public static PopupGravity FlipX(this PopupGravity gravity) + { + return (PopupGravity)FlipX((PopupAnchor)gravity); + } + + public static PopupGravity FlipY(this PopupGravity gravity) + { + return (PopupGravity)FlipY((PopupAnchor)gravity); + } } /// - /// Defines the popup position edge for and - /// . + /// Defines the edges around an anchor rectangle on which a popup will open. /// [Flags] - public enum PopupPositioningEdge + public enum PopupAnchor { /// /// The center of the anchor rectangle. @@ -338,6 +351,58 @@ namespace Avalonia.Controls.Primitives.PopupPositioning AllMask = VerticalMask|HorizontalMask } + /// + /// Defines the direction in which a popup will open. + /// + [Flags] + public enum PopupGravity + { + /// + /// The popup will be centered over the anchor edge. + /// + None, + + /// + /// The popup will be positioned above the anchor edge + /// + Top = 1, + + /// + /// The popup will be positioned below the anchor edge + /// + Bottom = 2, + + /// + /// The popup will be positioned to the left of the anchor edge + /// + Left = 4, + + /// + /// The popup will be positioned to the right of the anchor edge + /// + Right = 8, + + /// + /// The popup will be positioned to the top-left of the anchor edge + /// + TopLeft = Top | Left, + + /// + /// The popup will be positioned to the top-right of the anchor edge + /// + TopRight = Top | Right, + + /// + /// The popup will be positioned to the bottom-left of the anchor edge + /// + BottomLeft = Bottom | Left, + + /// + /// The popup will be positioned to the bottom-right of the anchor edge + /// + BottomRight = Bottom | Right, + } + /// /// Positions an . /// @@ -363,7 +428,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning public static void ConfigurePosition(ref this PopupPositionerParameters positionerParameters, TopLevel topLevel, IVisual target, PlacementMode placement, Point offset, - PopupPositioningEdge anchor, PopupPositioningEdge gravity) + PopupAnchor anchor, PopupGravity gravity, Rect? rect) { // We need a better way for tracking the last pointer position var pointer = topLevel.PointToClient(topLevel.PlatformImpl.MouseDevice.Position); @@ -373,8 +438,8 @@ namespace Avalonia.Controls.Primitives.PopupPositioning if (placement == PlacementMode.Pointer) { positionerParameters.AnchorRectangle = new Rect(pointer, new Size(1, 1)); - positionerParameters.Anchor = PopupPositioningEdge.TopLeft; - positionerParameters.Gravity = PopupPositioningEdge.BottomRight; + positionerParameters.Anchor = PopupAnchor.TopLeft; + positionerParameters.Gravity = PopupGravity.BottomRight; } else { @@ -384,32 +449,33 @@ namespace Avalonia.Controls.Primitives.PopupPositioning if (matrix == null) { if (target.GetVisualRoot() == null) - throw new InvalidCastException("Target control is not attached to the visual tree"); - throw new InvalidCastException("Target control is not in the same tree as the popup parent"); + throw new InvalidOperationException("Target control is not attached to the visual tree"); + throw new InvalidOperationException("Target control is not in the same tree as the popup parent"); } - positionerParameters.AnchorRectangle = new Rect(default, target.Bounds.Size) - .TransformToAABB(matrix.Value); + var bounds = new Rect(default, target.Bounds.Size); + var anchorRect = rect ?? bounds; + positionerParameters.AnchorRectangle = anchorRect.Intersect(bounds).TransformToAABB(matrix.Value); if (placement == PlacementMode.Right) { - positionerParameters.Anchor = PopupPositioningEdge.TopRight; - positionerParameters.Gravity = PopupPositioningEdge.BottomRight; + positionerParameters.Anchor = PopupAnchor.TopRight; + positionerParameters.Gravity = PopupGravity.BottomRight; } else if (placement == PlacementMode.Bottom) { - positionerParameters.Anchor = PopupPositioningEdge.BottomLeft; - positionerParameters.Gravity = PopupPositioningEdge.BottomRight; + positionerParameters.Anchor = PopupAnchor.BottomLeft; + positionerParameters.Gravity = PopupGravity.BottomRight; } else if (placement == PlacementMode.Left) { - positionerParameters.Anchor = PopupPositioningEdge.TopLeft; - positionerParameters.Gravity = PopupPositioningEdge.BottomLeft; + positionerParameters.Anchor = PopupAnchor.TopLeft; + positionerParameters.Gravity = PopupGravity.BottomLeft; } else if (placement == PlacementMode.Top) { - positionerParameters.Anchor = PopupPositioningEdge.TopLeft; - positionerParameters.Gravity = PopupPositioningEdge.TopRight; + positionerParameters.Anchor = PopupAnchor.TopLeft; + positionerParameters.Gravity = PopupGravity.TopRight; } else if (placement == PlacementMode.AnchorAndGravity) { diff --git a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs index bd23a13e7f..04167bbd15 100644 --- a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs +++ b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs @@ -39,38 +39,38 @@ namespace Avalonia.Controls.Primitives.PopupPositioning } - private static Point GetAnchorPoint(Rect anchorRect, PopupPositioningEdge edge) + private static Point GetAnchorPoint(Rect anchorRect, PopupAnchor edge) { double x, y; - if ((edge & PopupPositioningEdge.Left) != 0) + if ((edge & PopupAnchor.Left) != 0) x = anchorRect.X; - else if ((edge & PopupPositioningEdge.Right) != 0) + else if ((edge & PopupAnchor.Right) != 0) x = anchorRect.Right; else x = anchorRect.X + anchorRect.Width / 2; - if ((edge & PopupPositioningEdge.Top) != 0) + if ((edge & PopupAnchor.Top) != 0) y = anchorRect.Y; - else if ((edge & PopupPositioningEdge.Bottom) != 0) + else if ((edge & PopupAnchor.Bottom) != 0) y = anchorRect.Bottom; else y = anchorRect.Y + anchorRect.Height / 2; return new Point(x, y); } - private static Point Gravitate(Point anchorPoint, Size size, PopupPositioningEdge gravity) + private static Point Gravitate(Point anchorPoint, Size size, PopupGravity gravity) { double x, y; - if ((gravity & PopupPositioningEdge.Left) != 0) + if ((gravity & PopupGravity.Left) != 0) x = -size.Width; - else if ((gravity & PopupPositioningEdge.Right) != 0) + else if ((gravity & PopupGravity.Right) != 0) x = 0; else x = -size.Width / 2; - if ((gravity & PopupPositioningEdge.Top) != 0) + if ((gravity & PopupGravity.Top) != 0) y = -size.Height; - else if ((gravity & PopupPositioningEdge.Bottom) != 0) + else if ((gravity & PopupGravity.Bottom) != 0) y = 0; else y = -size.Height / 2; @@ -89,7 +89,7 @@ namespace Avalonia.Controls.Primitives.PopupPositioning private void Update(Size translatedSize, Size originalSize, - Rect anchorRect, PopupPositioningEdge anchor, PopupPositioningEdge gravity, + Rect anchorRect, PopupAnchor anchor, PopupGravity gravity, PopupPositionerConstraintAdjustment constraintAdjustment, Point offset) { var parentGeometry = _popup.ParentClientAreaScreenGeometry; @@ -116,28 +116,28 @@ namespace Avalonia.Controls.Primitives.PopupPositioning var bounds = GetBounds(); - bool FitsInBounds(Rect rc, PopupPositioningEdge edge = PopupPositioningEdge.AllMask) + bool FitsInBounds(Rect rc, PopupAnchor edge = PopupAnchor.AllMask) { - if ((edge & PopupPositioningEdge.Left) != 0 + if ((edge & PopupAnchor.Left) != 0 && rc.X < bounds.X) return false; - if ((edge & PopupPositioningEdge.Top) != 0 + if ((edge & PopupAnchor.Top) != 0 && rc.Y < bounds.Y) return false; - if ((edge & PopupPositioningEdge.Right) != 0 + if ((edge & PopupAnchor.Right) != 0 && rc.Right > bounds.Right) return false; - if ((edge & PopupPositioningEdge.Bottom) != 0 + if ((edge & PopupAnchor.Bottom) != 0 && rc.Bottom > bounds.Bottom) return false; return true; } - Rect GetUnconstrained(PopupPositioningEdge a, PopupPositioningEdge g) => + Rect GetUnconstrained(PopupAnchor a, PopupGravity g) => new Rect(Gravitate(GetAnchorPoint(anchorRect, a), translatedSize, g) + offset, translatedSize); @@ -145,11 +145,11 @@ namespace Avalonia.Controls.Primitives.PopupPositioning // If flipping geometry and anchor is allowed and helps, use the flipped one, // otherwise leave it as is - if (!FitsInBounds(geo, PopupPositioningEdge.HorizontalMask) + if (!FitsInBounds(geo, PopupAnchor.HorizontalMask) && (constraintAdjustment & PopupPositionerConstraintAdjustment.FlipX) != 0) { var flipped = GetUnconstrained(anchor.FlipX(), gravity.FlipX()); - if (FitsInBounds(flipped, PopupPositioningEdge.HorizontalMask)) + if (FitsInBounds(flipped, PopupAnchor.HorizontalMask)) geo = geo.WithX(flipped.X); } @@ -163,11 +163,11 @@ namespace Avalonia.Controls.Primitives.PopupPositioning // If flipping geometry and anchor is allowed and helps, use the flipped one, // otherwise leave it as is - if (!FitsInBounds(geo, PopupPositioningEdge.VerticalMask) + if (!FitsInBounds(geo, PopupAnchor.VerticalMask) && (constraintAdjustment & PopupPositionerConstraintAdjustment.FlipY) != 0) { var flipped = GetUnconstrained(anchor.FlipY(), gravity.FlipY()); - if (FitsInBounds(flipped, PopupPositioningEdge.VerticalMask)) + if (FitsInBounds(flipped, PopupAnchor.VerticalMask)) geo = geo.WithY(flipped.Y); } diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index 788fe03162..3b167d52e1 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -82,11 +82,12 @@ namespace Avalonia.Controls.Primitives } public void ConfigurePosition(IVisual target, PlacementMode placement, Point offset, - PopupPositioningEdge anchor = PopupPositioningEdge.None, - PopupPositioningEdge gravity = PopupPositioningEdge.None) + PopupAnchor anchor = PopupAnchor.None, + PopupGravity gravity = PopupGravity.None, + Rect? rect = null) { _positionerParameters.ConfigurePosition(_parent, target, - placement, offset, anchor, gravity); + placement, offset, anchor, gravity, rect); if (_positionerParameters.Size != default) UpdatePosition(); From 4334c124b9ad177228d64e3ce7f1c7de6f12b889 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 21 May 2020 15:43:17 +0200 Subject: [PATCH 05/48] Added additional placement properties to ContextMenu. --- src/Avalonia.Controls/ContextMenu.cs | 92 +++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/src/Avalonia.Controls/ContextMenu.cs b/src/Avalonia.Controls/ContextMenu.cs index 5a60fd37af..286cb6d6d8 100644 --- a/src/Avalonia.Controls/ContextMenu.cs +++ b/src/Avalonia.Controls/ContextMenu.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using Avalonia.Controls.Generators; using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; +using Avalonia.Controls.Primitives.PopupPositioning; using Avalonia.Controls.Templates; using Avalonia.Input; using Avalonia.Interactivity; @@ -19,11 +20,6 @@ namespace Avalonia.Controls /// public class ContextMenu : MenuBase, ISetterValue { - /// - /// Defines the property. - /// - public static readonly StyledProperty PlacementModeProperty = - Popup.PlacementModeProperty.AddOwner(); /// /// Defines the property. @@ -37,6 +33,30 @@ namespace Avalonia.Controls public static readonly StyledProperty VerticalOffsetProperty = Popup.VerticalOffsetProperty.AddOwner(); + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementAnchorProperty = + Popup.PlacementAnchorProperty.AddOwner(); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementGravityProperty = + Popup.PlacementGravityProperty.AddOwner(); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementModeProperty = + Popup.PlacementModeProperty.AddOwner(); + + /// + /// Defines the property. + /// + public static readonly StyledProperty PlacementRectProperty = + AvaloniaProperty.Register(nameof(PlacementRect)); + /// /// Defines the property. /// @@ -77,16 +97,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the placement mode of the popup in relation to the . - /// - public PlacementMode PlacementMode - { - get { return GetValue(PlacementModeProperty); } - set { SetValue(PlacementModeProperty, value); } - } - - /// - /// Gets or sets the Horizontal offset of the popup in relation to the + /// Gets or sets the Horizontal offset of the context menu in relation to the . /// public double HorizontalOffset { @@ -95,7 +106,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the Vertical offset of the popup in relation to the + /// Gets or sets the Vertical offset of the popup in relation to the . /// public double VerticalOffset { @@ -103,6 +114,52 @@ namespace Avalonia.Controls set { SetValue(VerticalOffsetProperty, value); } } + /// + /// Gets or sets the anchor point on the when + /// is . + /// + public PopupAnchor PlacementAnchor + { + get { return GetValue(PlacementAnchorProperty); } + set { SetValue(PlacementAnchorProperty, value); } + } + + /// + /// Gets or sets a value which defines in what direction the context menu should open + /// when is . + /// + public PopupGravity PlacementGravity + { + get { return GetValue(PlacementGravityProperty); } + set { SetValue(PlacementGravityProperty, value); } + } + + /// + /// Gets or sets the placement mode of the context menu in relation to the. + /// + public PlacementMode PlacementMode + { + get { return GetValue(PlacementModeProperty); } + set { SetValue(PlacementModeProperty, value); } + } + + /// + /// Gets or sets the the anchor rectangle within the parent that the popup will be placed + /// relative to when is . + /// + /// + /// The placement rect defines a rectangle relative to around + /// which the popup will be opened, with determining which edge + /// of the placement target is used. + /// + /// If unset, the anchor rectangle will be the bounds of the . + /// + public Rect? PlacementRect + { + get { return GetValue(PlacementRectProperty); } + set { SetValue(PlacementRectProperty, value); } + } + /// /// Gets or sets the control that is used to determine the popup's position. /// @@ -187,7 +244,10 @@ namespace Avalonia.Controls { HorizontalOffset = HorizontalOffset, VerticalOffset = VerticalOffset, + PlacementAnchor = PlacementAnchor, + PlacementGravity = PlacementGravity, PlacementMode = PlacementMode, + PlacementRect = PlacementRect, PlacementTarget = PlacementTarget ?? control, StaysOpen = false }; From 964f0b85d44c64231e3eabbee8db5180dda64be2 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 21 May 2020 16:04:51 +0200 Subject: [PATCH 06/48] Tweak doc comments. --- src/Avalonia.Controls/ContextMenu.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/ContextMenu.cs b/src/Avalonia.Controls/ContextMenu.cs index 286cb6d6d8..456af7bdde 100644 --- a/src/Avalonia.Controls/ContextMenu.cs +++ b/src/Avalonia.Controls/ContextMenu.cs @@ -106,7 +106,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the Vertical offset of the popup in relation to the . + /// Gets or sets the Vertical offset of the context menu in relation to the . /// public double VerticalOffset { @@ -144,7 +144,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the the anchor rectangle within the parent that the popup will be placed + /// Gets or sets the the anchor rectangle within the parent that the context menu will be placed /// relative to when is . /// /// From bd6d61c1724f16eae22ed8c117b17ec27923f19e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Sat, 30 May 2020 13:06:36 -0300 Subject: [PATCH 07/48] initial test of styling menus and context menus. --- src/Avalonia.Themes.Fluent/ContextMenu.xaml | 37 +++++++++++---------- src/Avalonia.Themes.Fluent/Menu.xaml | 2 +- src/Avalonia.Themes.Fluent/MenuItem.xaml | 37 ++++++++++++++++----- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ContextMenu.xaml b/src/Avalonia.Themes.Fluent/ContextMenu.xaml index 75f8f7c23d..9a583e2e30 100644 --- a/src/Avalonia.Themes.Fluent/ContextMenu.xaml +++ b/src/Avalonia.Themes.Fluent/ContextMenu.xaml @@ -1,22 +1,25 @@ \ No newline at end of file + diff --git a/src/Avalonia.Themes.Fluent/MenuItem.xaml b/src/Avalonia.Themes.Fluent/MenuItem.xaml index 314416cda0..d2586c6aa8 100644 --- a/src/Avalonia.Themes.Fluent/MenuItem.xaml +++ b/src/Avalonia.Themes.Fluent/MenuItem.xaml @@ -2,13 +2,23 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:conv="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls" xmlns:sys="clr-namespace:System;assembly=netstandard"> + + + + + + + + + + 12,9,12,12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 15e157f573..15e0925f85 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -343,5 +343,8 @@ + + + diff --git a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj index 3c3e14010d..00846f33fd 100644 --- a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj +++ b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj @@ -17,6 +17,14 @@ + + + + + + MSBuild:Compile + + diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.xaml b/src/Avalonia.Themes.Fluent/FluentTheme.xaml index 266acce971..dbbe3d6e69 100644 --- a/src/Avalonia.Themes.Fluent/FluentTheme.xaml +++ b/src/Avalonia.Themes.Fluent/FluentTheme.xaml @@ -52,4 +52,5 @@ + diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml new file mode 100644 index 0000000000..1fe9788839 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 97bbb3ba92bf35ea80aaa0bf0868117147070466 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Wed, 3 Jun 2020 14:10:54 +0200 Subject: [PATCH 10/48] added light fluent resources --- src/Avalonia.Themes.Default/ToggleSwitch.xaml | 335 +++++++++--------- .../Accents/FluentControlResourcesDark.xaml | 62 ++++ src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 39 +- 3 files changed, 254 insertions(+), 182 deletions(-) diff --git a/src/Avalonia.Themes.Default/ToggleSwitch.xaml b/src/Avalonia.Themes.Default/ToggleSwitch.xaml index e929810376..3cdcb3f6c5 100644 --- a/src/Avalonia.Themes.Default/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Default/ToggleSwitch.xaml @@ -1,170 +1,177 @@ - + - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - + - + + + + + + + - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 7364c339f1..8265c22a88 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -343,5 +343,67 @@ + + + + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 1fe9788839..2b665753b1 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -2,20 +2,21 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - - + + + - + @@ -31,17 +32,18 @@ - - - - - + + --> + + From 23fc2c945ee542a7a12d3185f03683274e7b65a9 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Thu, 4 Jun 2020 20:33:32 +0200 Subject: [PATCH 11/48] Dark resources and some minors --- src/Avalonia.Controls/ToggleSwitch.cs | 7 +- src/Avalonia.Themes.Default/ToggleSwitch.xaml | 11 +- .../Accents/FluentControlResourcesDark.xaml | 114 +++++++++--------- .../Accents/FluentControlResourcesLight.xaml | 60 ++++++++- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 12 +- 5 files changed, 134 insertions(+), 70 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index bc9c6f1ff4..19f282d2d1 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -3,9 +3,14 @@ namespace Avalonia.Controls { /// - /// A check box control. + /// A WinUi like ToggleSwitch control. /// public class ToggleSwitch : ToggleButton { } } +/********** Todo *********** + * + * Implement ContenOff property + * Implement ContentOn property. +*/ diff --git a/src/Avalonia.Themes.Default/ToggleSwitch.xaml b/src/Avalonia.Themes.Default/ToggleSwitch.xaml index 3cdcb3f6c5..69ac64bb28 100644 --- a/src/Avalonia.Themes.Default/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Default/ToggleSwitch.xaml @@ -93,7 +93,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -126,7 +126,7 @@ - + --> + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 8265c22a88..da3c20e844 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -345,65 +345,65 @@ - + 0 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 15e0925f85..00e2e38ade 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -345,6 +345,64 @@ - + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 2b665753b1..061551f9e7 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -93,7 +93,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -119,14 +119,14 @@ - + - + - + --> diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 061551f9e7..b423416d7c 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -143,9 +143,9 @@ - + --> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index b423416d7c..2c9309fe93 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -62,7 +62,7 @@ Name="PART_CircleThumb" Height="10" Width="10" Canvas.Top="7" - Canvas.Left="5"/> + /> @@ -126,7 +126,7 @@ - + diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs index 2d01d37dbe..3fd94bd60a 100644 --- a/samples/ControlCatalog/MainView.xaml.cs +++ b/samples/ControlCatalog/MainView.xaml.cs @@ -32,30 +32,30 @@ namespace ControlCatalog } - var light = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) - { - Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default") - }; - var dark = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) - { - Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseDark.xaml?assembly=Avalonia.Themes.Default") - }; + //var light = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) + //{ + // Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default") + //}; + //var dark = new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog")) + //{ + // Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseDark.xaml?assembly=Avalonia.Themes.Default") + //}; - var themes = this.Find("Themes"); - themes.SelectionChanged += (sender, e) => - { - switch (themes.SelectedIndex) - { - case 0: - Styles[0] = light; - break; - case 1: - Styles[0] = dark; - break; - } - }; - Styles.Add(light); + //var themes = this.Find("Themes"); + //themes.SelectionChanged += (sender, e) => + //{ + // switch (themes.SelectedIndex) + // { + // case 0: + // Styles[0] = light; + // break; + // case 1: + // Styles[0] = dark; + // break; + // } + //}; + //Styles.Add(light); var decorations = this.Find("Decorations"); decorations.SelectionChanged += (sender, e) => diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml index a0bb956425..670e30725b 100644 --- a/samples/ControlCatalog/MainWindow.xaml +++ b/samples/ControlCatalog/MainWindow.xaml @@ -7,7 +7,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:ControlCatalog.ViewModels" xmlns:v="clr-namespace:ControlCatalog.Views" - x:Class="ControlCatalog.MainWindow" WindowState="{Binding WindowState, Mode=TwoWay}" Background="Transparent"> + x:Class="ControlCatalog.MainWindow" WindowState="{Binding WindowState, Mode=TwoWay}"> diff --git a/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml b/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml index f90a0c4658..8888cf921a 100644 --- a/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml +++ b/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml @@ -32,6 +32,7 @@ + Light diff --git a/src/Avalonia.Themes.Default/ToggleSwitch.xaml b/src/Avalonia.Themes.Default/ToggleSwitch.xaml index 556e32faab..f7e2c209a2 100644 --- a/src/Avalonia.Themes.Default/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Default/ToggleSwitch.xaml @@ -1,7 +1,9 @@ - + + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=netstandard"> + @@ -12,7 +14,7 @@ - @@ -44,9 +46,10 @@ - + + - - - + Canvas.Top="7"/> + - - + + + + - + + + - - + + + + + @@ -157,22 +182,45 @@ + - + + + + + - - - - - + + + + + + + + + + + + + + + + - - + + + + 5 + 28 + RoyalBlue + White - + diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 2c9309fe93..bae8151563 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -1,177 +1,236 @@ + - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=netstandard"> + - + - - - + - + - - - + + /> - + + + + - - - - - - + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + 5 + 26 + RoyalBlue + + White + + + From f7d0088d553593ab3079c7f0060a9664717e219b Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Wed, 10 Jun 2020 18:46:54 +0200 Subject: [PATCH 17/48] Fix some colors --- samples/ControlCatalog/App.xaml | 11 +- src/Avalonia.Themes.Default/ToggleSwitch.xaml | 388 +++++++++-------- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 404 +++++++++--------- 3 files changed, 421 insertions(+), 382 deletions(-) diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml index de0c273dfb..d289767100 100644 --- a/samples/ControlCatalog/App.xaml +++ b/samples/ControlCatalog/App.xaml @@ -2,14 +2,15 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ControlCatalog.App"> - + - - + + + + + - - - - - - + - - + + - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + + - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - + + + + - - - - 5 - 28 - RoyalBlue - White - + + + 5 + 28 + RoyalBlue + + White + + + diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index bae8151563..2f311043fd 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -1,8 +1,8 @@ - + - + @@ -14,8 +14,8 @@ Text="Updates will be automaticly Downloaded and installed shile the computer is shutting down or restarting" TextWrapping="Wrap"/> + FontWeight="Medium" + VerticalAlignment="Bottom" /> @@ -25,154 +25,147 @@ - + FontWeight="Medium"/> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - + + - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + + - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - + + + + + + + + 5 + 28 + RoyalBlue + White - - - 5 - 26 - RoyalBlue - - White - - + From 78993eb33cb062c0bba8cc352c17fae1ecd31484 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Fri, 12 Jun 2020 19:48:52 +0200 Subject: [PATCH 18/48] Add contentoff and contentOn to toggleswitch Add more resource suport --- src/Avalonia.Controls/ToggleSwitch.cs | 115 ++++- .../Accents/FluentControlResourcesDark.xaml | 7 +- .../Accents/FluentControlResourcesLight.xaml | 10 +- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 465 ++++++++++-------- 4 files changed, 375 insertions(+), 222 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index 19f282d2d1..16caf8dbfb 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -1,16 +1,119 @@ using Avalonia.Controls.Primitives; +using Avalonia.Controls.Mixins; +using Avalonia.Controls.Presenters; +using Avalonia.Controls.Templates; +using Avalonia.LogicalTree; + namespace Avalonia.Controls { /// /// A WinUi like ToggleSwitch control. /// + /// + public class ToggleSwitch : ToggleButton { - } + public static readonly StyledProperty OffContentProperty = + AvaloniaProperty.Register(nameof(OffContent)); + + public static readonly StyledProperty OffContentTemplateProperty = + AvaloniaProperty.Register(nameof(OffContentTemplate)); + + + public static readonly StyledProperty OnContentProperty = + AvaloniaProperty.Register(nameof(OnContent)); + + public static readonly StyledProperty OnContentTemplateProperty = + AvaloniaProperty.Register(nameof(OnContentTemplate)); + + public object OnContent + { + get { return GetValue(OnContentProperty); } + set { SetValue(OnContentProperty, value); } + } + + public object OffContent + { + get { return GetValue(OffContentProperty); } + set { SetValue(OffContentProperty, value); } + } + + public IContentPresenter OffContentPresenter + { + get; + private set; + } + + public IContentPresenter OnContentPresenter + { + get; + private set; + } + + + public IDataTemplate OffContentTemplate + { + get { return GetValue(OffContentTemplateProperty); } + set { SetValue(OffContentTemplateProperty, value); } + } + + public IDataTemplate OnContentTemplate + { + get { return GetValue(OnContentTemplateProperty); } + set { SetValue(OnContentTemplateProperty, value); } + } + + private void OffContentChanged(AvaloniaPropertyChangedEventArgs e) + { + if (e.OldValue is ILogical oldChild) + { + LogicalChildren.Remove(oldChild); + } + + if (e.NewValue is ILogical newChild) + { + LogicalChildren.Add(newChild); + } + } + + private void OnContentChanged(AvaloniaPropertyChangedEventArgs e) + { + if (e.OldValue is ILogical oldChild) + { + LogicalChildren.Remove(oldChild); + } + + if (e.NewValue is ILogical newChild) + { + LogicalChildren.Add(newChild); + } + } + + static ToggleSwitch() + { + OffContentProperty.Changed.AddClassHandler((x, e) => x.OffContentChanged(e)); + OnContentProperty.Changed.AddClassHandler((x, e) => x.OnContentChanged(e)); + } + + + protected override bool RegisterContentPresenter(IContentPresenter presenter) + { + var result = base.RegisterContentPresenter(presenter); + + if (presenter.Name == "Part_OnContentPresenter") + { + OnContentPresenter = presenter; + result = true; + } + if (presenter.Name == "PART_OffContentPresenter") + { + OffContentPresenter = presenter; + result = true; + } + + return result; + } + } } -/********** Todo *********** - * - * Implement ContenOff property - * Implement ContentOn property. -*/ + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index da3c20e844..9fa0458db3 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -346,8 +346,10 @@ - 0 - 1 + + 0 + + 1 @@ -380,7 +382,6 @@ - diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 2426c1034c..5c23bc96ee 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -345,8 +345,12 @@ - 0 - 1 + + + + 0 + + 1 @@ -379,7 +383,6 @@ - @@ -404,6 +407,5 @@ - diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 2f311043fd..df9be1284a 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -4,7 +4,7 @@ xmlns:sys="clr-namespace:System;assembly=netstandard"> - + - @@ -26,244 +28,289 @@ Text="The previewer Shows a preview off your code, this could slow down your system" TextWrapping="Wrap"/> + /> - - + + + + + + + + - - + + + - - + + + + + + + + + + + + + - - + + + + + + + - - + - - - - - + - + + + + + + - - - - - - - + - - - - - - - + + + - - - - - - - - - - - - - - + - - - - - - - - + + + + + - + + + + + + + + 0,0,0,6 + 6 + 6 + 154 + 5 + 28 + + + From 0ac2468981bfefbaf3cfb0dc91f7733c7f7bbe00 Mon Sep 17 00:00:00 2001 From: Dariusz Komosinski Date: Sun, 14 Jun 2020 22:27:12 +0200 Subject: [PATCH 19/48] Fix typo in Track that was breaking layout for inverse horizontal tracks. --- src/Avalonia.Controls/Primitives/Track.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/Track.cs b/src/Avalonia.Controls/Primitives/Track.cs index 1db47a13e7..c91adaa26e 100644 --- a/src/Avalonia.Controls/Primitives/Track.cs +++ b/src/Avalonia.Controls/Primitives/Track.cs @@ -259,7 +259,7 @@ namespace Avalonia.Controls.Primitives CoerceLength(ref increaseButtonLength, arrangeSize.Width); CoerceLength(ref thumbLength, arrangeSize.Width); - offset = offset.WithY(isDirectionReversed ? increaseButtonLength + thumbLength : 0.0); + offset = offset.WithX(isDirectionReversed ? increaseButtonLength + thumbLength : 0.0); pieceSize = pieceSize.WithWidth(decreaseButtonLength); if (DecreaseButton != null) From 11190042ed258bf001ddf984336b5ffa2dc06f1e Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 14 Jun 2020 17:08:43 -0400 Subject: [PATCH 20/48] Add missed brushes for Fluent theme --- src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml | 3 +++ src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml index 44318ffa8f..0bea6c5781 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseDark.xaml @@ -138,6 +138,9 @@ + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml index e43a7ab4e7..ef296faa60 100644 --- a/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/BaseLight.xaml @@ -138,6 +138,9 @@ + + + From 19eac7224a22c14195600e9ca11da75ffa687ad1 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Mon, 15 Jun 2020 02:39:56 +0200 Subject: [PATCH 21/48] Fix border --- src/Avalonia.Controls/ToggleSwitch.cs | 2 +- .../Accents/FluentControlResourcesDark.xaml | 2 +- .../Accents/FluentControlResourcesLight.xaml | 2 +- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 266 +++++++++--------- 4 files changed, 139 insertions(+), 133 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index 16caf8dbfb..9af3ded18d 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -106,7 +106,7 @@ namespace Avalonia.Controls OnContentPresenter = presenter; result = true; } - if (presenter.Name == "PART_OffContentPresenter") + else if (presenter.Name == "PART_OffContentPresenter") { OffContentPresenter = presenter; result = true; diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 9fa0458db3..923180f96d 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -349,7 +349,7 @@ 0 - 1 + 1.5 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 5c23bc96ee..fd7a17d2e3 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -350,7 +350,7 @@ 0 - 1 + 1.5 diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index df9be1284a..6f74c0b715 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -1,12 +1,12 @@ - + xmlns:sys="clr-namespace:System;assembly=netstandard" + > - + @@ -44,148 +44,157 @@ - - - + + - + - + - - - - - + + + + + - - - - - + + + + + - + Grid.RowSpan="3" + Grid.ColumnSpan="3" + Margin="0,5" /> - + - + - + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - + + + + + + + + + + + + - - - - @@ -211,7 +220,7 @@ - + @@ -274,31 +283,29 @@ - - - - - - + + - @@ -309,7 +316,6 @@ 154 5 28 - From 0d685ac7d6d5570c691c4278fcb6f93c51306748 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Mon, 15 Jun 2020 02:11:33 -0400 Subject: [PATCH 22/48] Add :pressed :open :icon pseudoclasses to MenuItem --- src/Avalonia.Controls/MenuItem.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Avalonia.Controls/MenuItem.cs b/src/Avalonia.Controls/MenuItem.cs index b08519963b..912abc6de3 100644 --- a/src/Avalonia.Controls/MenuItem.cs +++ b/src/Avalonia.Controls/MenuItem.cs @@ -105,6 +105,7 @@ namespace Avalonia.Controls static MenuItem() { SelectableMixin.Attach(IsSelectedProperty); + PressedMixin.Attach(); CommandProperty.Changed.Subscribe(CommandChanged); FocusableProperty.OverrideDefaultValue(true); HeaderProperty.Changed.AddClassHandler((x, e) => x.HeaderChanged(e)); @@ -534,11 +535,13 @@ namespace Avalonia.Controls if (oldValue != null) { LogicalChildren.Remove(oldValue); + PseudoClasses.Remove(":icon"); } if (newValue != null) { LogicalChildren.Add(newValue); + PseudoClasses.Add(":icon"); } } @@ -566,11 +569,13 @@ namespace Avalonia.Controls { RaiseEvent(new RoutedEventArgs(SubmenuOpenedEvent)); IsSelected = true; + PseudoClasses.Add(":open"); } else { CloseSubmenus(); SelectedIndex = -1; + PseudoClasses.Remove(":open"); } } From edb7768ca269be2687bb796397c801fb54bb29b4 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Mon, 15 Jun 2020 02:11:42 -0400 Subject: [PATCH 23/48] Some MenuItem theme adjustments --- .../Accents/FluentControlResourcesDark.xaml | 56 +++- .../Accents/FluentControlResourcesLight.xaml | 54 +++- src/Avalonia.Themes.Fluent/Common.xaml | 6 + src/Avalonia.Themes.Fluent/ContextMenu.xaml | 58 +++- src/Avalonia.Themes.Fluent/Menu.xaml | 26 +- src/Avalonia.Themes.Fluent/MenuItem.xaml | 253 ++++++++++++------ src/Avalonia.Themes.Fluent/Separator.xaml | 12 +- 7 files changed, 351 insertions(+), 114 deletions(-) create mode 100644 src/Avalonia.Themes.Fluent/Common.xaml diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index cc35de185d..467f1f4ede 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -251,13 +251,56 @@ - 1 + 1 + 32 + 0,0 + + 12,0,0,0 + + 12,4,12,4 + + + + + + + + + + + + + + + + + + + + + + 11,9,11,10 11,4,11,7 1 - + + --> + --> + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index edbf68951f..a85b40893d 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -250,14 +250,57 @@ - 1 + 1 + 32 + 0,0 + + 12,0,0,0 + + 12,4,12,4 + + + + + + + + + + + + + + + + + + + + + 11,9,11,10 11,4,11,7 1 - + + --> + --> diff --git a/src/Avalonia.Themes.Fluent/Common.xaml b/src/Avalonia.Themes.Fluent/Common.xaml new file mode 100644 index 0000000000..e09e39d7cb --- /dev/null +++ b/src/Avalonia.Themes.Fluent/Common.xaml @@ -0,0 +1,6 @@ + + + diff --git a/src/Avalonia.Themes.Fluent/ContextMenu.xaml b/src/Avalonia.Themes.Fluent/ContextMenu.xaml index 9a583e2e30..44783a8dea 100644 --- a/src/Avalonia.Themes.Fluent/ContextMenu.xaml +++ b/src/Avalonia.Themes.Fluent/ContextMenu.xaml @@ -1,24 +1,60 @@ - - - - + + + + + + - + + - + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Separator.xaml b/src/Avalonia.Themes.Fluent/Separator.xaml index cf0db16ee6..dc968fe86c 100644 --- a/src/Avalonia.Themes.Fluent/Separator.xaml +++ b/src/Avalonia.Themes.Fluent/Separator.xaml @@ -4,17 +4,15 @@ - - - From dde9bebab1dd7a682b7758a7ef3eb47a04364374 Mon Sep 17 00:00:00 2001 From: ahopper Date: Mon, 15 Jun 2020 08:42:10 +0100 Subject: [PATCH 24/48] fix non zero minimum on slider --- src/Avalonia.Controls/Slider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Slider.cs b/src/Avalonia.Controls/Slider.cs index 64378a4eb2..fe1a4f5ac1 100644 --- a/src/Avalonia.Controls/Slider.cs +++ b/src/Avalonia.Controls/Slider.cs @@ -201,7 +201,7 @@ namespace Avalonia.Controls var invert = orient ? 0 : 1; var calcVal = Math.Abs(invert - logicalPos); var range = Maximum - Minimum; - var finalValue = calcVal * range; + var finalValue = calcVal * range + Minimum; Value = IsSnapToTickEnabled ? SnapToTick(finalValue) : finalValue; } From 752398188b3a83e50f6b5f3eb406b2f0abd4f76b Mon Sep 17 00:00:00 2001 From: Jumar Macato Date: Mon, 15 Jun 2020 06:06:43 -0400 Subject: [PATCH 25/48] Fix scroll events for legacy X11 --- src/Avalonia.X11/XI2Manager.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Avalonia.X11/XI2Manager.cs b/src/Avalonia.X11/XI2Manager.cs index 0734532d92..448635332c 100644 --- a/src/Avalonia.X11/XI2Manager.cs +++ b/src/Avalonia.X11/XI2Manager.cs @@ -237,6 +237,22 @@ namespace Avalonia.X11 RawPointerEventType.Move, ev.Position, ev.Modifiers)); } + if (ev.Type == XiEventType.XI_ButtonPress && ev.Button >= 4 && ev.Button <= 7 && !ev.Emulated) + { + Vector? scrollDelta = ev.Button switch + { + 4 => new Vector(0, 1), + 5 => new Vector(0, -1), + 6 => new Vector(1, 0), + 7 => new Vector(-1, 0), + _ => null + }; + + if (scrollDelta.HasValue) + client.ScheduleXI2Input(new RawMouseWheelEventArgs(client.MouseDevice, ev.Timestamp, + client.InputRoot, ev.Position, scrollDelta.Value, ev.Modifiers)); + } + if (ev.Type == XiEventType.XI_ButtonPress || ev.Type == XiEventType.XI_ButtonRelease) { var down = ev.Type == XiEventType.XI_ButtonPress; From c50bbd92011be07e4b5116690f86d2a495dc3664 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 15 Jun 2020 10:34:04 -0300 Subject: [PATCH 26/48] multi-touch enabled by default. --- src/Avalonia.X11/XI2Manager.cs | 2 +- src/Windows/Avalonia.Win32/WindowImpl.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.X11/XI2Manager.cs b/src/Avalonia.X11/XI2Manager.cs index 448635332c..4e44f55fe0 100644 --- a/src/Avalonia.X11/XI2Manager.cs +++ b/src/Avalonia.X11/XI2Manager.cs @@ -97,7 +97,7 @@ namespace Avalonia.X11 { _platform = platform; _x11 = platform.Info; - _multitouch = platform.Options?.EnableMultiTouch ?? false; + _multitouch = platform.Options?.EnableMultiTouch ?? true; var devices =(XIDeviceInfo*) XIQueryDevice(_x11.Display, (int)XiPredefinedDeviceId.XIAllMasterDevices, out int num); for (var c = 0; c < num; c++) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 0cf5a73b9f..81340fcde7 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -577,7 +577,7 @@ namespace Avalonia.Win32 Handle = new PlatformHandle(_hwnd, PlatformConstants.WindowHandleType); - _multitouch = Win32Platform.Options.EnableMultitouch ?? false; + _multitouch = Win32Platform.Options.EnableMultitouch ?? true; if (_multitouch) { From 551ea7711bfa4367da398ca33f37b0ab174e0d12 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Mon, 15 Jun 2020 18:44:52 +0200 Subject: [PATCH 27/48] Fix animation --- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 151 +++++++++++-------- 1 file changed, 86 insertions(+), 65 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 6f74c0b715..ca951edc9e 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -111,23 +111,30 @@ CornerRadius="10" BorderThickness="{DynamicResource ToggleSwitchOnStrokeThickness}"/> - + + + + + - - - - - - - + + + + + + @@ -170,32 +178,39 @@ + + - + - + - + - + - + @@ -243,49 +258,51 @@ + - + - - + + + + + - + - + - + + + - - - + + - + + - + + + 0,0,0,6 6 6 154 - 5 - 28 + 20 + 0 From 38b11d84c8c880ebe0cb162bb3b22d83d5c6695e Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Mon, 15 Jun 2020 18:40:04 -0300 Subject: [PATCH 28/48] add new screenshots --- readme.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 8ae3f1ad66..94ee4abaaa 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,12 @@ +# Avalonia + -# Avalonia +![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) + +![image](https://user-images.githubusercontent.com/4672627/84708488-00d14c00-af37-11ea-8031-37c7b9de3367.png) + +![image](https://user-images.githubusercontent.com/4672627/84707589-5b69a880-af35-11ea-87a6-7ad57a31d314.png) | Gitter Chat | Build Status (Win, Linux, OSX) | Open Collective | NuGet | MyGet | |---|---|---|---|---| From f53635383a91fb7579dd060ec9416669a3c1bcda Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Mon, 15 Jun 2020 18:41:25 -0300 Subject: [PATCH 29/48] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 94ee4abaaa..d5f032f1c5 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ ![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) -![image](https://user-images.githubusercontent.com/4672627/84708488-00d14c00-af37-11ea-8031-37c7b9de3367.png) +![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png) ![image](https://user-images.githubusercontent.com/4672627/84707589-5b69a880-af35-11ea-87a6-7ad57a31d314.png) From 4d9a37cf0a770e965eff719d4ab42c6ab680e8d4 Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Mon, 15 Jun 2020 18:42:25 -0300 Subject: [PATCH 30/48] Update readme.md --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index d5f032f1c5..b96bc23e6a 100644 --- a/readme.md +++ b/readme.md @@ -1,13 +1,13 @@ -# Avalonia +# Avalonia UI ![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) -![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png) - ![image](https://user-images.githubusercontent.com/4672627/84707589-5b69a880-af35-11ea-87a6-7ad57a31d314.png) +![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png) + | Gitter Chat | Build Status (Win, Linux, OSX) | Open Collective | NuGet | MyGet | |---|---|---|---|---| | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge&utm_content=badge&utm_medium=badge&utm_source=badge) | [![Build Status](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_apis/build/status/AvaloniaUI.Avalonia)](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/latest?definitionId=4) | [![Backers on Open Collective](https://opencollective.com/Avalonia/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/Avalonia/sponsors/badge.svg)](#sponsors) | [![NuGet](https://img.shields.io/nuget/v/Avalonia.svg)](https://www.nuget.org/packages/Avalonia) | [![MyGet](https://img.shields.io/myget/avalonia-ci/vpre/Avalonia.svg?label=myget)](https://www.myget.org/gallery/avalonia-ci) | From b1c8db8297e776dd55fcdda299bea52acff6ae37 Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Mon, 15 Jun 2020 18:43:31 -0300 Subject: [PATCH 31/48] Update readme.md --- readme.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/readme.md b/readme.md index b96bc23e6a..035309afcc 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,4 @@ -# Avalonia UI - - +| # Avalonia UI | | ![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) From 964e52b0605798a0f7ee95028452f98253275045 Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Mon, 15 Jun 2020 18:46:58 -0300 Subject: [PATCH 32/48] Update readme.md --- readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 035309afcc..e76518a2d0 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -| # Avalonia UI | | +# Avalonia UI ![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) @@ -10,6 +10,8 @@ |---|---|---|---|---| | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge&utm_content=badge&utm_medium=badge&utm_source=badge) | [![Build Status](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_apis/build/status/AvaloniaUI.Avalonia)](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/latest?definitionId=4) | [![Backers on Open Collective](https://opencollective.com/Avalonia/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/Avalonia/sponsors/badge.svg)](#sponsors) | [![NuGet](https://img.shields.io/nuget/v/Avalonia.svg)](https://www.nuget.org/packages/Avalonia) | [![MyGet](https://img.shields.io/myget/avalonia-ci/vpre/Avalonia.svg?label=myget)](https://www.myget.org/gallery/avalonia-ci) | + + ## About **Avalonia** is a cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of Operating Systems such as Windows (.NET Framework, .NET Core), Linux (via Xorg), macOS. From 0f8f459b3244bdbae3cd1f6a058c94422cb68bc4 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Mon, 15 Jun 2020 23:53:46 +0200 Subject: [PATCH 33/48] Little Fix --- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index ca951edc9e..2ae3b50b62 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -100,14 +100,14 @@ @@ -335,7 +335,7 @@ 6 6 154 - 20 + 22 0 From b18b70b82e8dd5509a1212e59b8455cf82462c39 Mon Sep 17 00:00:00 2001 From: JamRemco <58340108+JamRemco@users.noreply.github.com> Date: Tue, 16 Jun 2020 08:11:49 +0200 Subject: [PATCH 34/48] Adding Defauld values and change OuterBorderWidth --- src/Avalonia.Controls/ToggleSwitch.cs | 4 ++-- .../Accents/FluentControlResourcesDark.xaml | 2 +- .../Accents/FluentControlResourcesLight.xaml | 2 +- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 17 +++++++++-------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index 9af3ded18d..79638dce74 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -15,14 +15,14 @@ namespace Avalonia.Controls public class ToggleSwitch : ToggleButton { public static readonly StyledProperty OffContentProperty = - AvaloniaProperty.Register(nameof(OffContent)); + AvaloniaProperty.Register(nameof(OffContent), defaultValue:"Off"); public static readonly StyledProperty OffContentTemplateProperty = AvaloniaProperty.Register(nameof(OffContentTemplate)); public static readonly StyledProperty OnContentProperty = - AvaloniaProperty.Register(nameof(OnContent)); + AvaloniaProperty.Register(nameof(OnContent), defaultValue: "On"); public static readonly StyledProperty OnContentTemplateProperty = AvaloniaProperty.Register(nameof(OnContentTemplate)); diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 923180f96d..9fa0458db3 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -349,7 +349,7 @@ 0 - 1.5 + 1 diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index fd7a17d2e3..5c23bc96ee 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -350,7 +350,7 @@ 0 - 1.5 + 1 diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index 2ae3b50b62..d1892d8685 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -13,11 +13,12 @@ - + VerticalAlignment="Bottom" + /> @@ -28,7 +29,7 @@ Text="The previewer Shows a preview off your code, this could slow down your system" TextWrapping="Wrap"/> @@ -100,15 +101,15 @@ 6 6 154 - 22 + 20 0 From 45845115ff2782b078081abd13a98c1d57920000 Mon Sep 17 00:00:00 2001 From: "Artyom V. Gorchakov" Date: Tue, 16 Jun 2020 11:46:53 +0300 Subject: [PATCH 35/48] Make README.md look slightly more epic --- readme.md | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/readme.md b/readme.md index e76518a2d0..c40edca98b 100644 --- a/readme.md +++ b/readme.md @@ -1,30 +1,18 @@ -# Avalonia UI +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge&utm_content=badge&utm_medium=badge&utm_source=badge) [![Build Status](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_apis/build/status/AvaloniaUI.Avalonia)](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/latest?definitionId=4) [![Backers on Open Collective](https://opencollective.com/Avalonia/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/Avalonia/sponsors/badge.svg)](#sponsors) ![License](https://img.shields.io/github/license/avaloniaui/avalonia.svg) +
+[![NuGet](https://img.shields.io/nuget/v/Avalonia.svg)](https://www.nuget.org/packages/Avalonia) [![downloads](https://img.shields.io/nuget/dt/avalonia)](https://www.nuget.org/packages/Avalonia) [![MyGet](https://img.shields.io/myget/avalonia-ci/vpre/Avalonia.svg?label=myget)](https://www.myget.org/gallery/avalonia-ci) ![Size](https://img.shields.io/github/repo-size/avaloniaui/avalonia.svg) -![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) + -![image](https://user-images.githubusercontent.com/4672627/84707589-5b69a880-af35-11ea-87a6-7ad57a31d314.png) +## 📖 About AvaloniaUI -![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png) +Avalonia is a cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of Operating Systems such as Windows via .NET Framework and .NET Core, Linux via Xorg, macOS. Avalonia is ready for **General-Purpose Desktop App Development**. However, there may be some bugs and breaking changes as we continue along into this project's development. -| Gitter Chat | Build Status (Win, Linux, OSX) | Open Collective | NuGet | MyGet | -|---|---|---|---|---| -| [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/AvaloniaUI/Avalonia?utm_campaign=pr-badge&utm_content=badge&utm_medium=badge&utm_source=badge) | [![Build Status](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_apis/build/status/AvaloniaUI.Avalonia)](https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/latest?definitionId=4) | [![Backers on Open Collective](https://opencollective.com/Avalonia/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/Avalonia/sponsors/badge.svg)](#sponsors) | [![NuGet](https://img.shields.io/nuget/v/Avalonia.svg)](https://www.nuget.org/packages/Avalonia) | [![MyGet](https://img.shields.io/myget/avalonia-ci/vpre/Avalonia.svg?label=myget)](https://www.myget.org/gallery/avalonia-ci) | + - +To see the status of some of our features, please see our [Roadmap](https://github.com/AvaloniaUI/Avalonia/issues/2239). You can also see what [breaking changes](https://github.com/AvaloniaUI/Avalonia/issues/3538) we have planned and what our [past breaking changes](https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes) have been. [Awesome Avalonia](https://github.com/AvaloniaCommunity/awesome-avalonia) is community-curated list of awesome Avalonia UI tools, libraries, projects and resources. Go and see what people are building with Avalonia! -## About - -**Avalonia** is a cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of Operating Systems such as Windows (.NET Framework, .NET Core), Linux (via Xorg), macOS. - -**Avalonia** is ready for **General-Purpose Desktop App Development**. However, there may be some bugs and breaking changes as we continue along into this project's development. - -To see the status of some of our features, please see our [Roadmap here](https://github.com/AvaloniaUI/Avalonia/issues/2239). - -You can also see what [breaking changes](https://github.com/AvaloniaUI/Avalonia/issues/3538) we have planned and what our [past breaking changes](https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes) have been. - -[Awesome Avalonia](https://github.com/AvaloniaCommunity/awesome-avalonia) is community-curated list of awesome Avalonia UI tools, libraries, projects and resources. Go and see what people are building with Avalonia! - -## Getting Started +## 🚀 Getting Started The Avalonia [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) contains project and control templates that will help you get started, or you can use the .NET Core CLI. For a starer guide see our [documentation](http://avaloniaui.net/docs/quickstart/create-new-project). From 005c8919f2506e2844af460569bed423907b9d86 Mon Sep 17 00:00:00 2001 From: "Artyom V. Gorchakov" Date: Tue, 16 Jun 2020 12:14:59 +0300 Subject: [PATCH 36/48] Add a note about the new UI theme --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index c40edca98b..bf925f0add 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,8 @@ Avalonia is a cross-platform XAML-based UI framework providing a flexible stylin +> **Note:** The UI theme you see in the picture above is still work-in-progress and will be available in the upcoming Avalonia 0.10.0 release. However, you can connect to our nightly build feed and install latest pre-release versions of Avalonia NuGet packages, if you are willing to help out with the development and testing. See [Using nightly build feed](https://github.com/AvaloniaUI/Avalonia/wiki/Using-nightly-build-feed) for more info. + To see the status of some of our features, please see our [Roadmap](https://github.com/AvaloniaUI/Avalonia/issues/2239). You can also see what [breaking changes](https://github.com/AvaloniaUI/Avalonia/issues/3538) we have planned and what our [past breaking changes](https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes) have been. [Awesome Avalonia](https://github.com/AvaloniaCommunity/awesome-avalonia) is community-curated list of awesome Avalonia UI tools, libraries, projects and resources. Go and see what people are building with Avalonia! ## 🚀 Getting Started From 4d9efeca0cd34dbbb06a3edcbb9fb4fd49d96c25 Mon Sep 17 00:00:00 2001 From: danwalmsley Date: Tue, 16 Jun 2020 11:04:40 -0300 Subject: [PATCH 37/48] Update readme.md --- readme.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme.md b/readme.md index bf925f0add..491b517e42 100644 --- a/readme.md +++ b/readme.md @@ -26,6 +26,15 @@ Install-Package Avalonia Install-Package Avalonia.Desktop ``` +## Showcase + +Examples of UIs built with Avalonia +![image](https://user-images.githubusercontent.com/4672627/84707589-5b69a880-af35-11ea-87a6-7ad57a31d314.png) + +![image](https://user-images.githubusercontent.com/4672627/84708576-28281900-af37-11ea-8c88-e29dfcfa0558.png) + +![image](https://user-images.githubusercontent.com/4672627/84708947-c3b98980-af37-11ea-8c9d-503334615bbf.png) + ## JetBrains Rider If you need to develop Avalonia app with JetBrains Rider, go and *vote* on [this issue](https://youtrack.jetbrains.com/issue/RIDER-39247) in their tracker. JetBrains won't do things without their users telling them that they want the feature, so only **YOU** can make it happen. From b39bec2425c0c1767d903b453458c1aa1313cb66 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:05:41 -0300 Subject: [PATCH 38/48] code tidy. --- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 546 +++++++++---------- 1 file changed, 262 insertions(+), 284 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index d1892d8685..aba5e125ac 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -1,11 +1,16 @@ - + xmlns:sys="clr-namespace:System;assembly=netstandard"> + + 0,0,0,6 + 6 + 6 + 154 + 20 + 0 + - + VerticalAlignment="Bottom"/> @@ -28,116 +32,110 @@ - + - - - - - - - - - + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - 0,0,0,6 - 6 - 6 - 154 - 20 - 0 - - - From bfdb55f819c75dd498d98a8c9789e0b6cd293ca6 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:24:31 -0300 Subject: [PATCH 39/48] tidy template. --- src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 43 ++++---------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml index aba5e125ac..b4c4e7b429 100644 --- a/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Fluent/ToggleSwitch.xaml @@ -100,50 +100,30 @@ Grid.Row="1" Height="20" Width="40" - CornerRadius="100" + CornerRadius="10" BorderThickness="{DynamicResource ToggleSwitchOuterBorderStrokeThickness}" /> - + Width="20" Height="20"> + Width="20" Height="20"> - + Width="10" Height="10" /> - - + Width="10" Height="10" /> - - @@ -253,10 +233,6 @@ - - - - - From 960780e670b758ebfd5ddace911ba80b2925627e Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:31:30 -0300 Subject: [PATCH 40/48] make fluent and default templates match. --- src/Avalonia.Themes.Default/ToggleSwitch.xaml | 404 +++++++++--------- 1 file changed, 212 insertions(+), 192 deletions(-) diff --git a/src/Avalonia.Themes.Default/ToggleSwitch.xaml b/src/Avalonia.Themes.Default/ToggleSwitch.xaml index 7e1be173d9..b4c4e7b429 100644 --- a/src/Avalonia.Themes.Default/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Default/ToggleSwitch.xaml @@ -1,21 +1,28 @@ - - + + 0,0,0,6 + 6 + 6 + 154 + 20 + 0 + - - - + + - + @@ -27,247 +34,260 @@ TextWrapping="Wrap"/> + IsChecked="True" /> - - - + + - - + + + + + + + + - - - - - - - - - - - + - + - - - - - - - + - - - - + - - - - + - - - + + - + - - + - + - + - - - + - + + + - + - 5 - 28 - RoyalBlue - - White - + - + + + + From be33b3692d402e4175cfefc4c64a8331a5a44a67 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:31:46 -0300 Subject: [PATCH 41/48] remove stuff vs added to project file. --- .../Avalonia.Themes.Default.csproj | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj index d2c6d69bfe..cb3a185a2e 100644 --- a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj +++ b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj @@ -16,15 +16,7 @@ - - - - - - - MSBuild:Compile - - + From 29c575e6d9abdb1558308707844654bb2eda30a4 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:39:03 -0300 Subject: [PATCH 42/48] add missing documentation. --- src/Avalonia.Controls/ToggleSwitch.cs | 49 +++++++++++++++++++-------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index 79638dce74..ad35c43d87 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -8,31 +8,52 @@ using Avalonia.LogicalTree; namespace Avalonia.Controls { /// - /// A WinUi like ToggleSwitch control. + /// A Toggle Switch control. /// - /// - public class ToggleSwitch : ToggleButton { + static ToggleSwitch() + { + OffContentProperty.Changed.AddClassHandler((x, e) => x.OffContentChanged(e)); + OnContentProperty.Changed.AddClassHandler((x, e) => x.OnContentChanged(e)); + } + + /// + /// Defines the property. + /// public static readonly StyledProperty OffContentProperty = - AvaloniaProperty.Register(nameof(OffContent), defaultValue:"Off"); + AvaloniaProperty.Register(nameof(OffContent), defaultValue: "Off"); + /// + /// Defines the property. + /// public static readonly StyledProperty OffContentTemplateProperty = AvaloniaProperty.Register(nameof(OffContentTemplate)); - + /// + /// Defines the property. + /// public static readonly StyledProperty OnContentProperty = - AvaloniaProperty.Register(nameof(OnContent), defaultValue: "On"); + AvaloniaProperty.Register(nameof(OnContent), defaultValue: "On"); + /// + /// Defines the property. + /// public static readonly StyledProperty OnContentTemplateProperty = AvaloniaProperty.Register(nameof(OnContentTemplate)); + /// + /// Gets or Sets the Content that is displayed when in the On State. + /// public object OnContent { get { return GetValue(OnContentProperty); } set { SetValue(OnContentProperty, value); } } + /// + /// Gets or Sets the Content that is displayed when in the Off State. + /// public object OffContent { get { return GetValue(OffContentProperty); } @@ -51,13 +72,18 @@ namespace Avalonia.Controls private set; } - + /// + /// Gets or Sets the used to display the . + /// public IDataTemplate OffContentTemplate { get { return GetValue(OffContentTemplateProperty); } set { SetValue(OffContentTemplateProperty, value); } } + /// + /// Gets or Sets the used to display the . + /// public IDataTemplate OnContentTemplate { get { return GetValue(OnContentTemplateProperty); } @@ -90,13 +116,6 @@ namespace Avalonia.Controls } } - static ToggleSwitch() - { - OffContentProperty.Changed.AddClassHandler((x, e) => x.OffContentChanged(e)); - OnContentProperty.Changed.AddClassHandler((x, e) => x.OnContentChanged(e)); - } - - protected override bool RegisterContentPresenter(IContentPresenter presenter) { var result = base.RegisterContentPresenter(presenter); @@ -114,6 +133,6 @@ namespace Avalonia.Controls return result; } - } + } } From 62a88c8a5c937bab0b3ddcbe33a7776ac463a8eb Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:45:33 -0300 Subject: [PATCH 43/48] remove un-needed code. --- src/Avalonia.Controls/ToggleSwitch.cs | 33 --------------------------- 1 file changed, 33 deletions(-) diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index ad35c43d87..6c6426a31d 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -1,10 +1,7 @@ using Avalonia.Controls.Primitives; -using Avalonia.Controls.Mixins; -using Avalonia.Controls.Presenters; using Avalonia.Controls.Templates; using Avalonia.LogicalTree; - namespace Avalonia.Controls { /// @@ -60,18 +57,6 @@ namespace Avalonia.Controls set { SetValue(OffContentProperty, value); } } - public IContentPresenter OffContentPresenter - { - get; - private set; - } - - public IContentPresenter OnContentPresenter - { - get; - private set; - } - /// /// Gets or Sets the used to display the . /// @@ -115,24 +100,6 @@ namespace Avalonia.Controls LogicalChildren.Add(newChild); } } - - protected override bool RegisterContentPresenter(IContentPresenter presenter) - { - var result = base.RegisterContentPresenter(presenter); - - if (presenter.Name == "Part_OnContentPresenter") - { - OnContentPresenter = presenter; - result = true; - } - else if (presenter.Name == "PART_OffContentPresenter") - { - OffContentPresenter = presenter; - result = true; - } - - return result; - } } } From e3b9b762f3d5828f84cc82b05903a8a3fdb42155 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:49:17 -0300 Subject: [PATCH 44/48] restore template focus target. --- src/Avalonia.Themes.Default/ToggleSwitch.xaml | 1 + src/Avalonia.Themes.Fluent/ToggleSwitch.xaml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Avalonia.Themes.Default/ToggleSwitch.xaml b/src/Avalonia.Themes.Default/ToggleSwitch.xaml index b4c4e7b429..ed172b52ab 100644 --- a/src/Avalonia.Themes.Default/ToggleSwitch.xaml +++ b/src/Avalonia.Themes.Default/ToggleSwitch.xaml @@ -78,6 +78,7 @@ Date: Tue, 16 Jun 2020 14:52:19 -0300 Subject: [PATCH 45/48] remove whitespace. --- src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj index cb3a185a2e..c44cc358e8 100644 --- a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj +++ b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj @@ -16,7 +16,7 @@ - + From e61a2512015c1c90e3d8c9144ac427d960930919 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:53:30 -0300 Subject: [PATCH 46/48] remove vs added csproj junk. --- src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj index 00846f33fd..3c3e14010d 100644 --- a/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj +++ b/src/Avalonia.Themes.Fluent/Avalonia.Themes.Fluent.csproj @@ -17,14 +17,6 @@ - - - - - - MSBuild:Compile - - From 7d24103bda785a4ff5d38b1c000300c8968e1f87 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:57:29 -0300 Subject: [PATCH 47/48] tidy resources. --- .../Accents/FluentControlResourcesDark.xaml | 45 ++++++++++--------- .../Accents/FluentControlResourcesLight.xaml | 40 ++++++++--------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index 340a39ea7f..eb6cc610cc 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -1,5 +1,5 @@ - diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index 56d6f48341..cba20faf7c 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -1,5 +1,5 @@ - From dd492e1a2ce53aa2546f5810b44e5021a04f3fec Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 16 Jun 2020 14:58:37 -0300 Subject: [PATCH 48/48] remove from autocompletebox page. --- samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml b/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml index 8888cf921a..f90a0c4658 100644 --- a/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml +++ b/samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml @@ -32,7 +32,6 @@ - Light