コード例 #1
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);
        }
コード例 #2
0
ファイル: TextExtensions.cs プロジェクト: sung-su/maui
 public static void UpdateLineBreakMode(this TLabel platformLabel, Label label)
 {
     platformLabel.LineBreakMode = label.LineBreakMode.ToPlatform();
 }