示例#1
0
文件: Menu.cs 项目: wonrst/TizenFX
        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);
        }
示例#2
0
文件: Menu.cs 项目: hinohie/TizenFX
        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);
        }
示例#3
0
        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);
        }