How can I detect when the Flyout for a given DatePicker opens in WinUI 3?

94 Views Asked by At

I have a DatePicker on a Page and would like to know whenever the DatePickerFlyout associated with the DatePicker is opened. This would be straightforward if I had a reference to the relevant DatePickerFlyout (DatePickerFlyout has Opened and Opening events) , but I can't seem to find one.

Flyouts (Popups) appear in the Visual Tree under PopupRoot so I thought I might listen for changes in the PopupRoot branch. But walking up the tree stops at the RootScrollViewer, one level below PopupRoot, so I can't reference that branch.

VisualTreeHelper.GetOpenPopupsForXamlRoot() returns a list of open Popups (which includes Flyouts) but only if the Flyout in question is actually open.

Any idea how I can find and work with the actual DatePickerFlyout object?

Thank you in advance.

0

There are 0 best solutions below