diff --git a/Perspex.Controls/Popup.cs b/Perspex.Controls/Popup.cs index d2f87a1562..535e3e7849 100644 --- a/Perspex.Controls/Popup.cs +++ b/Perspex.Controls/Popup.cs @@ -76,9 +76,17 @@ namespace Perspex.Controls { if (this.popupRoot == null) { - this.popupRoot = new PopupRoot(); - this.popupRoot.Parent = this; - this.popupRoot[~PopupRoot.ContentProperty] = this[~ChildProperty]; + this.popupRoot = new PopupRoot() + { + Parent = this, + [~PopupRoot.ContentProperty] = this[~ChildProperty], + [~PopupRoot.WidthProperty] = this[~WidthProperty], + [~PopupRoot.HeightProperty] = this[~HeightProperty], + [~PopupRoot.MinWidthProperty] = this[~MinWidthProperty], + [~PopupRoot.MaxWidthProperty] = this[~MaxWidthProperty], + [~PopupRoot.MinHeightProperty] = this[~MinHeightProperty], + [~PopupRoot.MaxHeightProperty] = this[~MaxHeightProperty], + }; } this.popupRoot.SetPosition(this.GetPosition()); @@ -101,6 +109,11 @@ namespace Perspex.Controls this.IsOpen = false; } + protected override Size MeasureCore(Size availableSize) + { + return new Size(); + } + protected override void OnAttachedToVisualTree(IRenderRoot root) { base.OnAttachedToVisualTree(root); diff --git a/Perspex.Themes.Default/DropDownStyle.cs b/Perspex.Themes.Default/DropDownStyle.cs index 5fca90107c..b74aa18b2f 100644 --- a/Perspex.Themes.Default/DropDownStyle.cs +++ b/Perspex.Themes.Default/DropDownStyle.cs @@ -7,6 +7,7 @@ namespace Perspex.Themes.Default { using System.Linq; + using System.Reactive.Linq; using Perspex.Controls; using Perspex.Controls.Presenters; using Perspex.Controls.Primitives; @@ -89,6 +90,7 @@ namespace Perspex.Themes.Default PlacementTarget = control, StaysOpen = false, [~~Popup.IsOpenProperty] = control[~~DropDown.IsDropDownOpenProperty], + [~Popup.MinWidthProperty] = control[~DropDown.ActualSizeProperty].Cast().Select(x => (object)x.Width), } }, },