Browse Source
* Make FlyoutBase.IsOpen a public StyledProperty with two-way binding support Convert IsOpen from a DirectProperty with a protected setter to a StyledProperty with a public setter and TwoWay default binding mode. This enables MVVM scenarios where a ViewModel can control flyout visibility through data binding. The implementation mirrors the established Popup.IsOpen pattern: - Reentrancy guard (BeginIgnoringIsOpen scope) prevents recursive property change notifications when internal code syncs the property - SetCurrentValue preserves active bindings and styles (enforced by analyzer AVP1012) - _isOpen field tracks actual open state independently of the property value, since the property system sets the value before the change handler fires - _lastPlacementTarget enables re-opening at the last known target when IsOpen is set to true via binding - IsOpen reverts to false when no target is available or opening is cancelled, and reverts to true when closing is cancelled, keeping the property honest Fixes #18716 * ci: retrigger checks * Add API suppression for FlyoutBase.IsOpenProperty type change Suppress CP0002 for the intentional binary breaking change from DirectProperty<FlyoutBase, bool> to StyledProperty<bool>. * Pre-register owning control as flyout placement target When Button.Flyout or SplitButton.Flyout is set, the owning control now registers itself as the default placement target via an internal SetDefaultPlacementTarget method. This allows IsOpen = true to work on first use without a prior ShowAt call, addressing review feedback from MrJul. * Remove TwoWay default binding mode from IsOpenProperty Follow Avalonia convention: Popup.IsOpen and ToolTip.IsOpen use the default OneWay binding mode. TwoWay is reserved for input controls. Users opt in with Mode=TwoWay when needed.pull/20942/head
committed by
GitHub
6 changed files with 346 additions and 22 deletions
Loading…
Reference in new issue