Beispiel #1
0
        void OnLayout()
        {
            if (Geometry.Width == 0 || Geometry.Height == 0)
            {
                return;
            }

            var bound = Geometry;
            int navBarHeight;

            if (NavBarIsVisible)
            {
                var navBound = bound;
                navBarHeight    = DPExtensions.ConvertToScaledPixel(_navBar.GetDefaultNavBarHeight());
                navBound.Height = navBarHeight;

                if (_navBar != null)
                {
                    _navBar.Show();
                    _navBar.Geometry = navBound;
                    _navBar.RaiseTop();
                }
            }
            else
            {
                navBarHeight = 0;
                _navBar?.Hide();
            }

            bound.Y            += navBarHeight;
            bound.Height       -= navBarHeight;
            _viewStack.Geometry = bound;
        }
Beispiel #2
0
        EvasObject GetContent(object data, string part)
        {
            ShellSection section = data as ShellSection;

            var box = new EBox(NativeParent);

            box.Show();

            EImage icon = null;

            if (section.Icon != null)
            {
                icon = new TImage(NativeParent);
                icon.Show();
                box.PackEnd(icon);
            }

            var title = new TLabel(NativeParent)
            {
                Text     = section.Title,
                FontSize = DPExtensions.ConvertToEflFontPoint(14),
                HorizontalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Start,
                VerticalTextAlignment   = Tizen.UIExtensions.Common.TextAlignment.Center,
            };

            title.Show();
            box.PackEnd(title);
            int iconPadding = DPExtensions.ConvertToScaledPixel(this.GetDefaultIconPadding());
            int iconSize    = DPExtensions.ConvertToScaledPixel(this.GetDefaultIconSize());
            int cellHeight  = iconPadding * 2 + iconSize;

            box.SetLayoutCallback(() =>
            {
                var bound      = box.Geometry;
                int leftMargin = iconPadding;

                if (icon != null)
                {
                    var iconBound    = bound;
                    iconBound.X     += iconPadding;
                    iconBound.Y     += iconPadding;
                    iconBound.Width  = iconSize;
                    iconBound.Height = iconSize;
                    icon.Geometry    = iconBound;
                    leftMargin       = (2 * iconPadding + iconSize);
                }

                bound.X       += leftMargin;
                bound.Width   -= leftMargin;
                title.Geometry = bound;
            });

            box.MinimumHeight = cellHeight;
            return(box);
        }