Exemplo n.º 1
0
        /// <summary>
        /// Applies style to AlertDialog.
        /// </summary>
        /// <param name="viewStyle">The style to apply.</param>
        /// <since_tizen> 9 </since_tizen>
        public override void ApplyStyle(ViewStyle viewStyle)
        {
            styleApplied = false;

            base.ApplyStyle(viewStyle);

            // Apply Title style.
            if ((alertDialogStyle?.TitleTextLabel != null) && (DefaultTitleContent is TextLabel))
            {
                ((TextLabel)DefaultTitleContent)?.ApplyStyle(alertDialogStyle.TitleTextLabel);
            }

            // Apply Message style.
            if ((alertDialogStyle?.MessageTextLabel != null) && (DefaultContent is TextLabel))
            {
                ((TextLabel)DefaultContent)?.ApplyStyle(alertDialogStyle.MessageTextLabel);
            }

            // Apply ActionContent style.
            if (alertDialogStyle?.ActionContent != null)
            {
                DefaultActionContent?.ApplyStyle(alertDialogStyle.ActionContent);
            }

            styleApplied = true;

            // Calculate dialog position and children's positions based on padding sizes.
            CalculatePosition();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Applies style to AlertDialog.
        /// </summary>
        /// <param name="viewStyle">The style to apply.</param>
        /// <since_tizen> 9 </since_tizen>
        public override void ApplyStyle(ViewStyle viewStyle)
        {
            styleApplied = false;

            base.ApplyStyle(viewStyle);

            var alertDialogStyle = viewStyle as AlertDialogStyle;

            if (alertDialogStyle == null)
            {
                return;
            }

            // Apply ItemSpacing.
            if ((alertDialogStyle.ItemSpacing != null) && Layout is LinearLayout)
            {
                (Layout as LinearLayout).CellPadding = new Size2D(alertDialogStyle.ItemSpacing.Width, alertDialogStyle.ItemSpacing.Height);
            }

            // Apply Title style.
            if ((alertDialogStyle.TitleTextLabel != null) && (DefaultTitleContent is TextLabel))
            {
                ((TextLabel)DefaultTitleContent)?.ApplyStyle(alertDialogStyle.TitleTextLabel);
            }

            // Apply Message style.
            if ((alertDialogStyle.MessageTextLabel != null) && (DefaultContent is TextLabel))
            {
                ((TextLabel)DefaultContent)?.ApplyStyle(alertDialogStyle.MessageTextLabel);
            }

            // Apply ActionContent style.
            if (alertDialogStyle.ActionContent != null)
            {
                DefaultActionContent?.ApplyStyle(alertDialogStyle.ActionContent);
            }

            styleApplied = true;

            // Calculate dialog position and children's positions based on padding sizes.
            CalculatePosition();
        }