private static void RegisterPopupWithPlacementTarget(GamePopup popup, UIElement placementTarget) { var popupSite = placementTarget.FindVisualAncestorByType <GamePopupSite>(); if (popupSite == null) { return; } popupSite.Popups.Add(popup); popupSite.SizeChanged += popup.OnPopupSiteSizeChanged; }
private static void UnregisterPopupFromPlacementTarget(GamePopup popup, UIElement placementTarget) { var popupSite = placementTarget.FindVisualAncestorByType <GamePopupSite>(); if (popupSite == null) { return; } popupSite.SizeChanged -= popup.OnPopupSiteSizeChanged; popupSite.Popups.Remove(popup); }
private void UpdateRegisteredPopupSite(GamePopup popup, bool register) { if (register) { if (popup.RegisteredPopupSite != this) { if (popup.RegisteredPopupSite != null) { throw new InvalidOperationException("GamePopup is already registered with another GamePopupSite."); } popup.RegisteredPopupSite = this; } } else if (popup.RegisteredPopupSite == this) { popup.RegisteredPopupSite = null; } }
internal GamePopupRoot(GamePopup popup) { _popup = popup; Initialize(); }
internal void SetupLayoutBindings(GamePopup popup) { _adornerDecorator.SetBinding( WidthProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(WidthProperty) }); _adornerDecorator.SetBinding( HeightProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(HeightProperty) }); _adornerDecorator.SetBinding( MinWidthProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(MinWidthProperty) }); _adornerDecorator.SetBinding( MinHeightProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(MinHeightProperty) }); _adornerDecorator.SetBinding( MaxWidthProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(MaxWidthProperty) }); _adornerDecorator.SetBinding( MaxHeightProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(MaxHeightProperty), }); _adornerDecorator.SetBinding( ClipToBoundsProperty, new Binding { Mode = BindingMode.OneWay, Source = popup, Path = new PropertyPath(ClipToBoundsProperty), }); }