private void Initialize() { Layout = new AbsoluteLayout(); WidthSpecification = LayoutParamPolicies.WrapContent; HeightSpecification = LayoutParamPolicies.WrapContent; BackgroundColor = Color.Transparent; // Menu is added to Anchor so Menu should exclude layouting because // if Anchor has Layout, then Menu is displayed at an incorrect position. ExcludeLayouting = true; Content = CreateDefaultContent(); if (styleApplied && (menuStyle != null)) { Content.ApplyStyle(menuStyle.Content); } Scrim = CreateDefaultScrim(); menuItemGroup = new MenuItemGroup(); layer = new Layer(); layer.Add(this); }
protected override void Dispose(DisposeTypes type) { if (disposed) { return; } if (type == DisposeTypes.Explicit) { if (Content != null) { if (menuItems != null) { foreach (MenuItem menuItem in menuItems) { Content.Remove(menuItem); } } Utility.Dispose(Content); } Utility.Dispose(Scrim); menuItemGroup = null; layer.Remove(this); Window.RemoveLayer(layer); layer.Dispose(); } base.Dispose(type); }
private void Initialize() { Layout = new AbsoluteLayout(); WidthSpecification = LayoutParamPolicies.WrapContent; HeightSpecification = LayoutParamPolicies.WrapContent; // Menu is added to Anchor so Menu should exclude layouting because // if Anchor has Layout, then Menu is displayed at an incorrect position. ExcludeLayouting = true; Content = CreateDefaultContent(); Scrim = CreateDefaultScrim(); menuItemGroup = new MenuItemGroup(); layer = new Layer(); layer.Add(this); }