I want display popup on top my app with additional information, my info is Listview
with ~500 items I've tried both:
problem with
flyout
-> it has probably scrollViewer inside so my listview doesn't Virtualize correctly everything else is ok. There is my code:Flyout myFlyout = new Flyout(); myFlyout.Placement = FlyoutPlacementMode.Full; myFlyout.Content = myListView; myFlyout.ShowAt(this);
problem with
popup
-> it isn't centered, verticalAlignment doesn't work, horizontal neitherPopup myPopup = new Popup(); myPopup.Child = myListView; myPopup.IsOpen = true;
So which way should I go, try to edit Template of flyout or center my popup by setting vertical and horizontal offset? Or there's better way to display popup like window with info like list of items or such other
By default,
Flyout
has aScrollViewer
inside. You can find its template at FlyoutPresenter styles and templates. You can edit it and use new template by setting Flyout.FlyoutPresenterStyle property if you need.If you want to use
Popup
'sHorizontalAlignment
andVerticalAlignment
property, you need addPopup
as a child of an element in the visual tree. For example:But plesae note that this actually dose not make the
Popup
centered. It make thePopup
's upper left corner centered. In the Remarks section of Popup class, it says:I think while using
HorizontalAlignment.Center
andVerticalAlignment.Center
, it set theHorizontalOffset
andVerticalOffset
to the half of its parent's width and height.And in the Remarks section, it also says:
So I think in your case using
Flyout
is a better way.