Esempio n. 1
0
        public static Button CreateActionButton(ActionBase action, RenderContext context)
        {
            ActionConfig styling  = context.Config.Actions;
            var          uiButton = new Button()
            {
#if WPF
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
#endif
            };

            uiButton.SetBackgroundColor(styling.BackgroundColor, context);
            uiButton.SetBorderColor(styling.BackgroundColor, context);
            uiButton.SetThickness(context.Config.Actions.BorderThickness);
            uiButton.Style = context.GetStyle($"Adaptive.{action.Type}");

            xaml.TextBlock uiTitle = new xaml.TextBlock()
            {
                Text     = action.Title,
                FontSize = styling.FontSize,
                Margin   = new Thickness(styling.Padding.Left, styling.Padding.Top, styling.Padding.Right, styling.Padding.Bottom),
            };
            uiTitle.SetFontWeight(styling.FontWeight);
            uiTitle.SetColor(styling.TextColor, context);
            uiTitle.Style    = context.GetStyle($"Adaptive.Action.Title");
            uiButton.Content = uiTitle;
            string name = context.GetType().Name.Replace("Action", String.Empty);

            return(uiButton);
        }