예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
 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;
     }
 }
예제 #4
0
 internal GamePopupRoot(GamePopup popup)
 {
     _popup = popup;
     Initialize();
 }
예제 #5
0
        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),
            });
        }