Browse Source

Merge pull request #10664 from robloo/placementmode

`PlacementMode` -> `Placement`
knock-knock-are-integration-tests-even-alive
Max Katz 4 years ago
committed by GitHub
parent
commit
aa1aa33488
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      samples/IntegrationTestApp/MainWindow.axaml.cs
  2. 103
      src/Avalonia.Controls/ContextMenu.cs
  3. 2
      src/Avalonia.Controls/DateTimePickers/DatePicker.cs
  4. 2
      src/Avalonia.Controls/DateTimePickers/TimePicker.cs
  5. 14
      src/Avalonia.Controls/Flyouts/PopupFlyoutBase.cs
  6. 80
      src/Avalonia.Controls/Primitives/Popup.cs
  7. 2
      src/Avalonia.Controls/SplitButton/SplitButton.cs
  8. 2
      src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
  9. 2
      src/Avalonia.Themes.Fluent/Controls/Menu.xaml
  10. 2
      src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml
  11. 2
      src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
  12. 2
      src/Avalonia.Themes.Simple/Controls/DatePicker.xaml
  13. 2
      src/Avalonia.Themes.Simple/Controls/Menu.xaml
  14. 2
      src/Avalonia.Themes.Simple/Controls/MenuItem.xaml
  15. 2
      src/Avalonia.Themes.Simple/Controls/TimePicker.xaml
  16. 2
      tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs
  17. 2
      tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs
  18. 20
      tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs

2
samples/IntegrationTestApp/MainWindow.axaml.cs

@ -162,7 +162,7 @@ namespace IntegrationTestApp
var popup = new Popup var popup = new Popup
{ {
WindowManagerAddShadowHint = false, WindowManagerAddShadowHint = false,
PlacementMode = PlacementMode.AnchorAndGravity, Placement = PlacementMode.AnchorAndGravity,
PlacementAnchor = PopupAnchor.Top, PlacementAnchor = PopupAnchor.Top,
PlacementGravity = PopupGravity.Bottom, PlacementGravity = PopupGravity.Bottom,
Width= 200, Width= 200,

103
src/Avalonia.Controls/ContextMenu.cs

@ -54,11 +54,17 @@ namespace Avalonia.Controls
public static readonly StyledProperty<PopupGravity> PlacementGravityProperty = public static readonly StyledProperty<PopupGravity> PlacementGravityProperty =
Popup.PlacementGravityProperty.AddOwner<ContextMenu>(); Popup.PlacementGravityProperty.AddOwner<ContextMenu>();
/// <summary>
/// Defines the <see cref="Placement"/> property.
/// </summary>
public static readonly StyledProperty<PlacementMode> PlacementProperty =
Popup.PlacementProperty.AddOwner<ContextMenu>();
/// <summary> /// <summary>
/// Defines the <see cref="PlacementMode"/> property. /// Defines the <see cref="PlacementMode"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<PlacementMode> PlacementModeProperty = [Obsolete("Use the Placement property instead.")]
Popup.PlacementModeProperty.AddOwner<ContextMenu>(); public static readonly StyledProperty<PlacementMode> PlacementModeProperty = PlacementProperty;
/// <summary> /// <summary>
/// Defines the <see cref="PlacementRect"/> property. /// Defines the <see cref="PlacementRect"/> property.
@ -108,99 +114,80 @@ namespace Avalonia.Controls
static ContextMenu() static ContextMenu()
{ {
ItemsPanelProperty.OverrideDefaultValue<ContextMenu>(DefaultPanel); ItemsPanelProperty.OverrideDefaultValue<ContextMenu>(DefaultPanel);
PlacementModeProperty.OverrideDefaultValue<ContextMenu>(PlacementMode.Pointer); PlacementProperty.OverrideDefaultValue<ContextMenu>(PlacementMode.Pointer);
ContextMenuProperty.Changed.Subscribe(ContextMenuChanged); ContextMenuProperty.Changed.Subscribe(ContextMenuChanged);
AutomationProperties.AccessibilityViewProperty.OverrideDefaultValue<ContextMenu>(AccessibilityView.Control); AutomationProperties.AccessibilityViewProperty.OverrideDefaultValue<ContextMenu>(AccessibilityView.Control);
AutomationProperties.ControlTypeOverrideProperty.OverrideDefaultValue<ContextMenu>(AutomationControlType.Menu); AutomationProperties.ControlTypeOverrideProperty.OverrideDefaultValue<ContextMenu>(AutomationControlType.Menu);
} }
/// <summary> /// <inheritdoc cref="Popup.HorizontalOffset"/>
/// Gets or sets the Horizontal offset of the context menu in relation to the <see cref="PlacementTarget"/>.
/// </summary>
public double HorizontalOffset public double HorizontalOffset
{ {
get { return GetValue(HorizontalOffsetProperty); } get => GetValue(HorizontalOffsetProperty);
set { SetValue(HorizontalOffsetProperty, value); } set => SetValue(HorizontalOffsetProperty, value);
} }
/// <summary> /// <inheritdoc cref="Popup.VerticalOffset"/>
/// Gets or sets the Vertical offset of the context menu in relation to the <see cref="PlacementTarget"/>.
/// </summary>
public double VerticalOffset public double VerticalOffset
{ {
get { return GetValue(VerticalOffsetProperty); } get => GetValue(VerticalOffsetProperty);
set { SetValue(VerticalOffsetProperty, value); } set => SetValue(VerticalOffsetProperty, value);
} }
/// <summary> /// <inheritdoc cref="Popup.PlacementAnchor"/>
/// Gets or sets the anchor point on the <see cref="PlacementRect"/> when <see cref="PlacementMode"/>
/// is <see cref="PlacementMode.AnchorAndGravity"/>.
/// </summary>
public PopupAnchor PlacementAnchor public PopupAnchor PlacementAnchor
{ {
get { return GetValue(PlacementAnchorProperty); } get => GetValue(PlacementAnchorProperty);
set { SetValue(PlacementAnchorProperty, value); } set => SetValue(PlacementAnchorProperty, value);
} }
/// <summary> /// <inheritdoc cref="Popup.PlacementConstraintAdjustment"/>
/// Gets or sets a value describing how the context menu position will be adjusted if the
/// unadjusted position would result in the context menu being partly constrained.
/// </summary>
public PopupPositionerConstraintAdjustment PlacementConstraintAdjustment public PopupPositionerConstraintAdjustment PlacementConstraintAdjustment
{ {
get { return GetValue(PlacementConstraintAdjustmentProperty); } get => GetValue(PlacementConstraintAdjustmentProperty);
set { SetValue(PlacementConstraintAdjustmentProperty, value); } set => SetValue(PlacementConstraintAdjustmentProperty, value);
} }
/// <summary> /// <inheritdoc cref="Popup.PlacementGravity"/>
/// Gets or sets a value which defines in what direction the context menu should open
/// when <see cref="PlacementMode"/> is <see cref="PlacementMode.AnchorAndGravity"/>.
/// </summary>
public PopupGravity PlacementGravity public PopupGravity PlacementGravity
{ {
get { return GetValue(PlacementGravityProperty); } get => GetValue(PlacementGravityProperty);
set { SetValue(PlacementGravityProperty, value); } set => SetValue(PlacementGravityProperty, value);
} }
/// <summary> /// <inheritdoc cref="Placement"/>
/// Gets or sets the placement mode of the context menu in relation to the<see cref="PlacementTarget"/>. [Obsolete("Use the Placement property instead.")]
/// </summary>
public PlacementMode PlacementMode public PlacementMode PlacementMode
{ {
get { return GetValue(PlacementModeProperty); } get => GetValue(PlacementProperty);
set { SetValue(PlacementModeProperty, value); } set => SetValue(PlacementProperty, value);
}
/// <inheritdoc cref="Popup.Placement"/>
public PlacementMode Placement
{
get => GetValue(PlacementProperty);
set => SetValue(PlacementProperty, value);
} }
public bool WindowManagerAddShadowHint public bool WindowManagerAddShadowHint
{ {
get { return GetValue(WindowManagerAddShadowHintProperty); } get => GetValue(WindowManagerAddShadowHintProperty);
set { SetValue(WindowManagerAddShadowHintProperty, value); } set => SetValue(WindowManagerAddShadowHintProperty, value);
} }
/// <summary> /// <inheritdoc cref="Popup.PlacementRect"/>
/// Gets or sets the the anchor rectangle within the parent that the context menu will be placed
/// relative to when <see cref="PlacementMode"/> is <see cref="PlacementMode.AnchorAndGravity"/>.
/// </summary>
/// <remarks>
/// The placement rect defines a rectangle relative to <see cref="PlacementTarget"/> around
/// which the popup will be opened, with <see cref="PlacementAnchor"/> determining which edge
/// of the placement target is used.
///
/// If unset, the anchor rectangle will be the bounds of the <see cref="PlacementTarget"/>.
/// </remarks>
public Rect? PlacementRect public Rect? PlacementRect
{ {
get { return GetValue(PlacementRectProperty); } get => GetValue(PlacementRectProperty);
set { SetValue(PlacementRectProperty, value); } set => SetValue(PlacementRectProperty, value);
} }
/// <summary> /// <inheritdoc cref="Popup.PlacementTarget"/>
/// Gets or sets the control that is used to determine the popup's position.
/// </summary>
public Control? PlacementTarget public Control? PlacementTarget
{ {
get { return GetValue(PlacementTargetProperty); } get => GetValue(PlacementTargetProperty);
set { SetValue(PlacementTargetProperty, value); } set => SetValue(PlacementTargetProperty, value);
} }
/// <summary> /// <summary>
@ -343,9 +330,9 @@ namespace Avalonia.Controls
((ISetLogicalParent)_popup).SetParent(control); ((ISetLogicalParent)_popup).SetParent(control);
} }
_popup.PlacementMode = !requestedByPointer && PlacementMode == PlacementMode.Pointer _popup.Placement = !requestedByPointer && Placement == PlacementMode.Pointer
? PlacementMode.Bottom ? PlacementMode.Bottom
: PlacementMode; : Placement;
//Position of the line below is really important. //Position of the line below is really important.
//All styles are being applied only when control has logical parent. //All styles are being applied only when control has logical parent.

2
src/Avalonia.Controls/DateTimePickers/DatePicker.cs

@ -389,7 +389,7 @@ namespace Avalonia.Controls
_presenter.Date = SelectedDate ?? DateTimeOffset.Now; _presenter.Date = SelectedDate ?? DateTimeOffset.Now;
_popup.PlacementMode = PlacementMode.AnchorAndGravity; _popup.Placement = PlacementMode.AnchorAndGravity;
_popup.PlacementAnchor = Primitives.PopupPositioning.PopupAnchor.Bottom; _popup.PlacementAnchor = Primitives.PopupPositioning.PopupAnchor.Bottom;
_popup.PlacementGravity = Primitives.PopupPositioning.PopupGravity.Bottom; _popup.PlacementGravity = Primitives.PopupPositioning.PopupGravity.Bottom;
_popup.PlacementConstraintAdjustment = Primitives.PopupPositioning.PopupPositionerConstraintAdjustment.SlideY; _popup.PlacementConstraintAdjustment = Primitives.PopupPositioning.PopupPositionerConstraintAdjustment.SlideY;

2
src/Avalonia.Controls/DateTimePickers/TimePicker.cs

@ -255,7 +255,7 @@ namespace Avalonia.Controls
_presenter.Time = SelectedTime ?? DateTime.Now.TimeOfDay; _presenter.Time = SelectedTime ?? DateTime.Now.TimeOfDay;
_popup.PlacementMode = PlacementMode.AnchorAndGravity; _popup.Placement = PlacementMode.AnchorAndGravity;
_popup.PlacementAnchor = Primitives.PopupPositioning.PopupAnchor.Bottom; _popup.PlacementAnchor = Primitives.PopupPositioning.PopupAnchor.Bottom;
_popup.PlacementGravity = Primitives.PopupPositioning.PopupGravity.Bottom; _popup.PlacementGravity = Primitives.PopupPositioning.PopupGravity.Bottom;
_popup.PlacementConstraintAdjustment = Primitives.PopupPositioning.PopupPositionerConstraintAdjustment.SlideY; _popup.PlacementConstraintAdjustment = Primitives.PopupPositioning.PopupPositionerConstraintAdjustment.SlideY;

14
src/Avalonia.Controls/Flyouts/PopupFlyoutBase.cs

@ -14,9 +14,9 @@ namespace Avalonia.Controls.Primitives
{ {
public abstract class PopupFlyoutBase : FlyoutBase, IPopupHostProvider public abstract class PopupFlyoutBase : FlyoutBase, IPopupHostProvider
{ {
/// <inheritdoc cref="Popup.PlacementModeProperty"/> /// <inheritdoc cref="Popup.PlacementProperty"/>
public static readonly StyledProperty<PlacementMode> PlacementProperty = public static readonly StyledProperty<PlacementMode> PlacementProperty =
Popup.PlacementModeProperty.AddOwner<PopupFlyoutBase>(); Popup.PlacementProperty.AddOwner<PopupFlyoutBase>();
/// <inheritdoc cref="Popup.HorizontalOffsetProperty"/> /// <inheritdoc cref="Popup.HorizontalOffsetProperty"/>
public static readonly StyledProperty<double> HorizontalOffsetProperty = public static readonly StyledProperty<double> HorizontalOffsetProperty =
@ -64,15 +64,13 @@ namespace Avalonia.Controls.Primitives
protected Popup Popup => _popupLazy.Value; protected Popup Popup => _popupLazy.Value;
/// <summary> /// <inheritdoc cref="Popup.Placement"/>
/// Gets or sets the desired placement.
/// </summary>
public PlacementMode Placement public PlacementMode Placement
{ {
get => GetValue(PlacementProperty); get => GetValue(PlacementProperty);
set => SetValue(PlacementProperty, value); set => SetValue(PlacementProperty, value);
} }
/// <inheritdoc cref="Popup.PlacementGravity"/> /// <inheritdoc cref="Popup.PlacementGravity"/>
public PopupGravity PlacementGravity public PopupGravity PlacementGravity
{ {
@ -423,11 +421,11 @@ namespace Avalonia.Controls.Primitives
Popup.PlacementGravity = PlacementGravity; Popup.PlacementGravity = PlacementGravity;
if (showAtPointer) if (showAtPointer)
{ {
Popup.PlacementMode = PlacementMode.Pointer; Popup.Placement = PlacementMode.Pointer;
} }
else else
{ {
Popup.PlacementMode = Placement; Popup.Placement = Placement;
Popup.PlacementConstraintAdjustment = Popup.PlacementConstraintAdjustment =
PopupPositioning.PopupPositionerConstraintAdjustment.SlideX | PopupPositioning.PopupPositionerConstraintAdjustment.SlideX |
PopupPositioning.PopupPositionerConstraintAdjustment.SlideY; PopupPositioning.PopupPositionerConstraintAdjustment.SlideY;

80
src/Avalonia.Controls/Primitives/Popup.cs

@ -65,11 +65,17 @@ namespace Avalonia.Controls.Primitives
public static readonly StyledProperty<PopupGravity> PlacementGravityProperty = public static readonly StyledProperty<PopupGravity> PlacementGravityProperty =
AvaloniaProperty.Register<Popup, PopupGravity>(nameof(PlacementGravity)); AvaloniaProperty.Register<Popup, PopupGravity>(nameof(PlacementGravity));
/// <summary>
/// Defines the <see cref="Placement"/> property.
/// </summary>
public static readonly StyledProperty<PlacementMode> PlacementProperty =
AvaloniaProperty.Register<Popup, PlacementMode>(nameof(Placement), defaultValue: PlacementMode.Bottom);
/// <summary> /// <summary>
/// Defines the <see cref="PlacementMode"/> property. /// Defines the <see cref="PlacementMode"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<PlacementMode> PlacementModeProperty = [Obsolete("Use the Placement property instead.")]
AvaloniaProperty.Register<Popup, PlacementMode>(nameof(PlacementMode), defaultValue: PlacementMode.Bottom); public static readonly StyledProperty<PlacementMode> PlacementModeProperty = PlacementProperty;
/// <summary> /// <summary>
/// Defines the <see cref="PlacementRect"/> property. /// Defines the <see cref="PlacementRect"/> property.
@ -146,8 +152,8 @@ namespace Avalonia.Controls.Primitives
public bool WindowManagerAddShadowHint public bool WindowManagerAddShadowHint
{ {
get { return GetValue(WindowManagerAddShadowHintProperty); } get => GetValue(WindowManagerAddShadowHintProperty);
set { SetValue(WindowManagerAddShadowHintProperty, value); } set => SetValue(WindowManagerAddShadowHintProperty, value);
} }
/// <summary> /// <summary>
@ -156,8 +162,8 @@ namespace Avalonia.Controls.Primitives
[Content] [Content]
public Control? Child public Control? Child
{ {
get { return GetValue(ChildProperty); } get => GetValue(ChildProperty);
set { SetValue(ChildProperty, value); } set => SetValue(ChildProperty, value);
} }
/// <summary> /// <summary>
@ -205,13 +211,13 @@ namespace Avalonia.Controls.Primitives
} }
/// <summary> /// <summary>
/// Gets or sets the anchor point on the <see cref="PlacementRect"/> when <see cref="PlacementMode"/> /// Gets or sets the anchor point on the <see cref="PlacementRect"/> when <see cref="Placement"/>
/// is <see cref="PlacementMode.AnchorAndGravity"/>. /// is <see cref="PlacementMode.AnchorAndGravity"/>.
/// </summary> /// </summary>
public PopupAnchor PlacementAnchor public PopupAnchor PlacementAnchor
{ {
get { return GetValue(PlacementAnchorProperty); } get => GetValue(PlacementAnchorProperty);
set { SetValue(PlacementAnchorProperty, value); } set => SetValue(PlacementAnchorProperty, value);
} }
/// <summary> /// <summary>
@ -220,32 +226,40 @@ namespace Avalonia.Controls.Primitives
/// </summary> /// </summary>
public PopupPositionerConstraintAdjustment PlacementConstraintAdjustment public PopupPositionerConstraintAdjustment PlacementConstraintAdjustment
{ {
get { return GetValue(PlacementConstraintAdjustmentProperty); } get => GetValue(PlacementConstraintAdjustmentProperty);
set { SetValue(PlacementConstraintAdjustmentProperty, value); } set => SetValue(PlacementConstraintAdjustmentProperty, value);
} }
/// <summary> /// <summary>
/// Gets or sets a value which defines in what direction the popup should open /// Gets or sets a value which defines in what direction the popup should open
/// when <see cref="PlacementMode"/> is <see cref="PlacementMode.AnchorAndGravity"/>. /// when <see cref="Placement"/> is <see cref="PlacementMode.AnchorAndGravity"/>.
/// </summary> /// </summary>
public PopupGravity PlacementGravity public PopupGravity PlacementGravity
{ {
get { return GetValue(PlacementGravityProperty); } get => GetValue(PlacementGravityProperty);
set { SetValue(PlacementGravityProperty, value); } set => SetValue(PlacementGravityProperty, value);
}
/// <inheritdoc cref="Placement"/>
[Obsolete("Use the Placement property instead.")]
public PlacementMode PlacementMode
{
get => GetValue(PlacementProperty);
set => SetValue(PlacementProperty, value);
} }
/// <summary> /// <summary>
/// Gets or sets the placement mode of the popup in relation to the <see cref="PlacementTarget"/>. /// Gets or sets the desired placement of the popup in relation to the <see cref="PlacementTarget"/>.
/// </summary> /// </summary>
public PlacementMode PlacementMode public PlacementMode Placement
{ {
get { return GetValue(PlacementModeProperty); } get => GetValue(PlacementProperty);
set { SetValue(PlacementModeProperty, value); } set => SetValue(PlacementProperty, value);
} }
/// <summary> /// <summary>
/// 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 popup will be placed
/// relative to when <see cref="PlacementMode"/> is <see cref="PlacementMode.AnchorAndGravity"/>. /// relative to when <see cref="Placement"/> is <see cref="PlacementMode.AnchorAndGravity"/>.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// The placement rect defines a rectangle relative to <see cref="PlacementTarget"/> around /// The placement rect defines a rectangle relative to <see cref="PlacementTarget"/> around
@ -256,8 +270,8 @@ namespace Avalonia.Controls.Primitives
/// </remarks> /// </remarks>
public Rect? PlacementRect public Rect? PlacementRect
{ {
get { return GetValue(PlacementRectProperty); } get => GetValue(PlacementRectProperty);
set { SetValue(PlacementRectProperty, value); } set => SetValue(PlacementRectProperty, value);
} }
/// <summary> /// <summary>
@ -266,8 +280,8 @@ namespace Avalonia.Controls.Primitives
[ResolveByName] [ResolveByName]
public Control? PlacementTarget public Control? PlacementTarget
{ {
get { return GetValue(PlacementTargetProperty); } get => GetValue(PlacementTargetProperty);
set { SetValue(PlacementTargetProperty, value); } set => SetValue(PlacementTargetProperty, value);
} }
/// <summary> /// <summary>
@ -301,8 +315,8 @@ namespace Avalonia.Controls.Primitives
/// </summary> /// </summary>
public double HorizontalOffset public double HorizontalOffset
{ {
get { return GetValue(HorizontalOffsetProperty); } get => GetValue(HorizontalOffsetProperty);
set { SetValue(HorizontalOffsetProperty, value); } set => SetValue(HorizontalOffsetProperty, value);
} }
/// <summary> /// <summary>
@ -310,8 +324,8 @@ namespace Avalonia.Controls.Primitives
/// </summary> /// </summary>
public double VerticalOffset public double VerticalOffset
{ {
get { return GetValue(VerticalOffsetProperty); } get => GetValue(VerticalOffsetProperty);
set { SetValue(VerticalOffsetProperty, value); } set => SetValue(VerticalOffsetProperty, value);
} }
/// <summary> /// <summary>
@ -319,8 +333,8 @@ namespace Avalonia.Controls.Primitives
/// </summary> /// </summary>
public bool Topmost public bool Topmost
{ {
get { return GetValue(TopmostProperty); } get => GetValue(TopmostProperty);
set { SetValue(TopmostProperty, value); } set => SetValue(TopmostProperty, value);
} }
IPopupHost? IPopupHostProvider.PopupHost => Host; IPopupHost? IPopupHostProvider.PopupHost => Host;
@ -404,7 +418,7 @@ namespace Avalonia.Controls.Primitives
(x, handler) => x.LostFocus -= handler).DisposeWith(handlerCleanup); (x, handler) => x.LostFocus -= handler).DisposeWith(handlerCleanup);
// Recalculate popup position on parent moved/resized, but not if placement was on pointer // Recalculate popup position on parent moved/resized, but not if placement was on pointer
if (PlacementMode != PlacementMode.Pointer) if (Placement != PlacementMode.Pointer)
{ {
SubscribeToEventHandler<IWindowImpl, Action<PixelPoint>>(window.PlatformImpl, WindowPositionChanged, SubscribeToEventHandler<IWindowImpl, Action<PixelPoint>>(window.PlatformImpl, WindowPositionChanged,
(x, handler) => x.PositionChanged += handler, (x, handler) => x.PositionChanged += handler,
@ -534,7 +548,7 @@ namespace Avalonia.Controls.Primitives
UpdateHostSizing(_openState.PopupHost, _openState.TopLevel, _openState.PlacementTarget); UpdateHostSizing(_openState.PopupHost, _openState.TopLevel, _openState.PlacementTarget);
} }
else if (change.Property == PlacementTargetProperty || else if (change.Property == PlacementTargetProperty ||
change.Property == PlacementModeProperty || change.Property == PlacementProperty ||
change.Property == HorizontalOffsetProperty || change.Property == HorizontalOffsetProperty ||
change.Property == VerticalOffsetProperty || change.Property == VerticalOffsetProperty ||
change.Property == PlacementAnchorProperty || change.Property == PlacementAnchorProperty ||
@ -567,7 +581,7 @@ namespace Avalonia.Controls.Primitives
{ {
popupHost.ConfigurePosition( popupHost.ConfigurePosition(
placementTarget, placementTarget,
PlacementMode, Placement,
new Point(HorizontalOffset, VerticalOffset), new Point(HorizontalOffset, VerticalOffset),
PlacementAnchor, PlacementAnchor,
PlacementGravity, PlacementGravity,
@ -615,7 +629,7 @@ namespace Avalonia.Controls.Primitives
return; return;
_openState.PopupHost.ConfigurePosition( _openState.PopupHost.ConfigurePosition(
placementTarget, placementTarget,
PlacementMode, Placement,
new Point(HorizontalOffset, VerticalOffset), new Point(HorizontalOffset, VerticalOffset),
PlacementAnchor, PlacementAnchor,
PlacementGravity, PlacementGravity,

2
src/Avalonia.Controls/SplitButton/SplitButton.cs

@ -172,7 +172,7 @@ namespace Avalonia.Controls
flyout.Opened += Flyout_Opened; flyout.Opened += Flyout_Opened;
flyout.Closed += Flyout_Closed; flyout.Closed += Flyout_Closed;
_flyoutPropertyChangedDisposable = flyout.GetPropertyChangedObservable(Popup.PlacementModeProperty).Subscribe(Flyout_PlacementPropertyChanged); _flyoutPropertyChangedDisposable = flyout.GetPropertyChangedObservable(Popup.PlacementProperty).Subscribe(Flyout_PlacementPropertyChanged);
} }
} }

2
src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml

@ -127,7 +127,7 @@
<Popup Name="PART_Popup" WindowManagerAddShadowHint="False" <Popup Name="PART_Popup" WindowManagerAddShadowHint="False"
IsLightDismissEnabled="True" PlacementTarget="{TemplateBinding}" IsLightDismissEnabled="True" PlacementTarget="{TemplateBinding}"
PlacementMode="Bottom"> Placement="Bottom">
<DatePickerPresenter Name="PART_PickerPresenter" /> <DatePickerPresenter Name="PART_PickerPresenter" />
</Popup> </Popup>

2
src/Avalonia.Themes.Fluent/Controls/Menu.xaml

@ -37,7 +37,7 @@
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}" IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
PlacementMode="BottomEdgeAlignedLeft" Placement="BottomEdgeAlignedLeft"
OverlayInputPassThroughElement="{Binding $parent[Menu]}"> OverlayInputPassThroughElement="{Binding $parent[Menu]}">
<Border Background="{DynamicResource MenuFlyoutPresenterBackground}" <Border Background="{DynamicResource MenuFlyoutPresenterBackground}"
BorderBrush="{DynamicResource MenuFlyoutPresenterBorderBrush}" BorderBrush="{DynamicResource MenuFlyoutPresenterBorderBrush}"

2
src/Avalonia.Themes.Fluent/Controls/MenuItem.xaml

@ -118,7 +118,7 @@
</Border> </Border>
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
WindowManagerAddShadowHint="False" WindowManagerAddShadowHint="False"
PlacementMode="Right" Placement="Right"
HorizontalOffset="{DynamicResource MenuFlyoutSubItemPopupHorizontalOffset}" HorizontalOffset="{DynamicResource MenuFlyoutSubItemPopupHorizontalOffset}"
IsLightDismissEnabled="False" IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"> IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}">

2
src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml

@ -151,7 +151,7 @@
WindowManagerAddShadowHint="False" WindowManagerAddShadowHint="False"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}" PlacementTarget="{TemplateBinding}"
PlacementMode="Bottom"> Placement="Bottom">
<TimePickerPresenter Name="PART_PickerPresenter" /> <TimePickerPresenter Name="PART_PickerPresenter" />
</Popup> </Popup>

2
src/Avalonia.Themes.Simple/Controls/DatePicker.xaml

@ -142,7 +142,7 @@
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
PlacementMode="Bottom" Placement="Bottom"
PlacementTarget="{TemplateBinding}" PlacementTarget="{TemplateBinding}"
WindowManagerAddShadowHint="False"> WindowManagerAddShadowHint="False">
<DatePickerPresenter Name="PART_PickerPresenter" /> <DatePickerPresenter Name="PART_PickerPresenter" />

2
src/Avalonia.Themes.Simple/Controls/Menu.xaml

@ -27,7 +27,7 @@
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}" IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
PlacementMode="BottomEdgeAlignedLeft" Placement="BottomEdgeAlignedLeft"
OverlayInputPassThroughElement="{Binding $parent[Menu]}"> OverlayInputPassThroughElement="{Binding $parent[Menu]}">
<Border Background="{DynamicResource ThemeBackgroundBrush}" <Border Background="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}" BorderBrush="{DynamicResource ThemeBorderMidBrush}"

2
src/Avalonia.Themes.Simple/Controls/MenuItem.xaml

@ -65,7 +65,7 @@
IsLightDismissEnabled="False" IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen, IsOpen="{TemplateBinding IsSubMenuOpen,
Mode=TwoWay}" Mode=TwoWay}"
PlacementMode="Right"> Placement="Right">
<Border Background="{DynamicResource ThemeBackgroundBrush}" <Border Background="{DynamicResource ThemeBackgroundBrush}"
BorderBrush="{DynamicResource ThemeBorderMidBrush}" BorderBrush="{DynamicResource ThemeBorderMidBrush}"
BorderThickness="{TemplateBinding BorderThickness}"> BorderThickness="{TemplateBinding BorderThickness}">

2
src/Avalonia.Themes.Simple/Controls/TimePicker.xaml

@ -156,7 +156,7 @@
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
PlacementMode="Bottom" Placement="Bottom"
PlacementTarget="{TemplateBinding}" PlacementTarget="{TemplateBinding}"
WindowManagerAddShadowHint="False"> WindowManagerAddShadowHint="False">
<TimePickerPresenter Name="PART_PickerPresenter" /> <TimePickerPresenter Name="PART_PickerPresenter" />

2
tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs

@ -303,7 +303,7 @@ namespace Avalonia.Controls.UnitTests
window.Show(); window.Show();
var c = new ContextMenu(); var c = new ContextMenu();
c.PlacementMode = PlacementMode.Bottom; c.Placement = PlacementMode.Bottom;
c.Open(button); c.Open(button);
var overlay = LightDismissOverlayLayer.GetLightDismissOverlayLayer(window); var overlay = LightDismissOverlayLayer.GetLightDismissOverlayLayer(window);

2
tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs

@ -67,7 +67,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
using (UnitTestApplication.Start(TestServices.StyledWindow)) using (UnitTestApplication.Start(TestServices.StyledWindow))
{ {
var window = new Window(); var window = new Window();
var target = new Popup {PlacementMode = PlacementMode.Pointer}; var target = new Popup {Placement = PlacementMode.Pointer};
var child = new Control(); var child = new Control();
window.Content = target; window.Content = target;

20
tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs

@ -207,7 +207,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
{ {
using (CreateServices()) using (CreateServices())
{ {
var target = new Popup() {PlacementMode = PlacementMode.Pointer}; var target = new Popup() {Placement = PlacementMode.Pointer};
var root = PreparedWindow(target); var root = PreparedWindow(target);
target.Open(); target.Open();
@ -226,7 +226,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
using (CreateServices()) using (CreateServices())
{ {
var window = PreparedWindow(); var window = PreparedWindow();
var target = new Popup() {PlacementMode = PlacementMode.Pointer}; var target = new Popup() {Placement = PlacementMode.Pointer};
window.Content = target; window.Content = target;
@ -249,7 +249,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
using (CreateServices()) using (CreateServices())
{ {
var window = PreparedWindow(); var window = PreparedWindow();
var target = new Popup() {PlacementMode = PlacementMode.Pointer}; var target = new Popup() {Placement = PlacementMode.Pointer};
window.Content = target; window.Content = target;
window.ApplyTemplate(); window.ApplyTemplate();
@ -274,7 +274,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
using (CreateServices()) using (CreateServices())
{ {
var window = PreparedWindow(); var window = PreparedWindow();
var target = new Popup() { PlacementMode = PlacementMode.Pointer }; var target = new Popup() { Placement = PlacementMode.Pointer };
window.Content = target; window.Content = target;
window.ApplyTemplate(); window.ApplyTemplate();
@ -742,7 +742,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
{ {
Width = 400, Width = 400,
Height = 200, Height = 200,
PlacementMode = PlacementMode.Pointer Placement = PlacementMode.Pointer
}; };
var window = PreparedWindow(popup); var window = PreparedWindow(popup);
window.Show(); window.Show();
@ -791,7 +791,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
var popup = new Popup() var popup = new Popup()
{ {
PlacementTarget = placementTarget, PlacementTarget = placementTarget,
PlacementMode = PlacementMode.Bottom, Placement = PlacementMode.Bottom,
Width = 10, Width = 10,
Height = 10 Height = 10
}; };
@ -852,7 +852,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
var popup = new Popup() var popup = new Popup()
{ {
PlacementTarget = placementTarget, PlacementTarget = placementTarget,
PlacementMode = PlacementMode.Pointer, Placement = PlacementMode.Pointer,
Width = 10, Width = 10,
Height = 10 Height = 10
}; };
@ -907,7 +907,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
var popup = new Popup() var popup = new Popup()
{ {
PlacementTarget = placementTarget, PlacementTarget = placementTarget,
PlacementMode = PlacementMode.Bottom, Placement = PlacementMode.Bottom,
Width = 10, Width = 10,
Height = 10 Height = 10
}; };
@ -967,7 +967,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
var popup = new Popup() var popup = new Popup()
{ {
PlacementTarget = placementTarget, PlacementTarget = placementTarget,
PlacementMode = PlacementMode.Pointer, Placement = PlacementMode.Pointer,
Width = 10, Width = 10,
Height = 10 Height = 10
}; };
@ -1020,7 +1020,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
Width = 20, Width = 20,
Height = 20, Height = 20,
PlacementTarget = parentPopup, PlacementTarget = parentPopup,
PlacementMode = PlacementMode.AnchorAndGravity, Placement = PlacementMode.AnchorAndGravity,
PlacementAnchor = PopupAnchor.TopLeft, PlacementAnchor = PopupAnchor.TopLeft,
PlacementGravity = PopupGravity.BottomRight PlacementGravity = PopupGravity.BottomRight
}; };

Loading…
Cancel
Save