-
-
Notifications
You must be signed in to change notification settings - Fork 885
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
A DropDownButton will always show its flyout with ContextMenu.Placement="Bottom".
Expected WPF design would use a default of "Bottom" (via MetaData or Control Template) but allow a developer to set a different Placement on the ContextMenu in Content.
Cause: The (protected) OnClick event handler.
protected override void OnClick()
{
base.OnClick();
if (_contextMenu is null)
{
return;
}
_contextMenu.SetCurrentValue(MinWidthProperty, ActualWidth);
_contextMenu.SetCurrentValue(ContextMenu.PlacementTargetProperty, this);
_contextMenu.SetCurrentValue(
ContextMenu.PlacementProperty,
System.Windows.Controls.Primitives.PlacementMode.Bottom
);
_contextMenu.SetCurrentValue(ContextMenu.IsOpenProperty, true);
}
It's bad practice. Please improve.
To Reproduce
Example: A window with a single DropDownButton with VerticalAlignment=Bottom: Flyout appears outside the window. (Until Wpf.Core detects the monitor Edge and reposition it.)
Expected behavior
Respect the (optional) Placement in the ContextMenu.
<ui:DropDownButton>
<ui:DropDownButton.Flyout>
<ContextMenu Placement="Top">
Screenshots
No response
OS version
win11
.NET version
net 10
WPF-UI NuGet version
4.0.3
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working