Exemplo n.º 1
0
        private void UpdateTemplate()
        {
            var color = Helper.GetColorByOffset(_linearGradientBrush.GradientStops, SldTheme.Value / 7);

            ButtonHelper.SetCornerRadius(BtnCustom, new CornerRadius(SldCornerRadius.Value));
            BtnCustom.Width = SldWidth.Value;

            if (BtnCustom.Width < 60)
            {
                BtnCustom.Content = "";
                ButtonHelper.SetWaitingContent(BtnCustom, null);
            }
            else
            {
                BtnCustom.Content = " Button";
                ButtonHelper.SetWaitingContent(BtnCustom, "Please wait...");
            }


            switch (ButtonHelper.GetButtonStyle(BtnCustom))
            {
            case ButtonStyle.Standard:
                BtnCustom.Foreground = Colors.White.ToBrush();
                BtnCustom.Background = new Color()
                {
                    A = 200, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;

            case ButtonStyle.Hollow:
                BtnCustom.Background  = Colors.Transparent.ToBrush();
                BtnCustom.Foreground  = color.ToBrush();
                BtnCustom.BorderBrush = color.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;

            case ButtonStyle.Outline:
                BtnCustom.Background = Colors.Transparent.ToBrush();
                BtnCustom.Foreground = new Color()
                {
                    A = 150, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                BtnCustom.BorderBrush = new Color()
                {
                    A = 150, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;

            case ButtonStyle.Link:
                BtnCustom.Background = Colors.Transparent.ToBrush();
                BtnCustom.Foreground = new Color()
                {
                    A = 150, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                ButtonHelper.SetHoverBrush(BtnCustom, color.ToBrush());
                break;
            }
        }
Exemplo n.º 2
0
        private void UpdateCode()
        {
            var buttonStyle  = ButtonHelper.GetButtonStyle(BtnCustom);
            var cornerRadius = SldCornerRadius.Value;

            TbCode.Text = "<Button  Height=\"30\"" +
                          $"\nWidth=\"{BtnCustom.Width}\"" +
                          $"\nContent=\"{BtnCustom.Content}\"" +
                          "\nFontFamily=\"{DynamicResource FontAwesome}\"" +
                          (buttonStyle == ButtonStyle.Standard ? "" : $"\npu:ButtonHelper.ButtonStyle=\"{buttonStyle}\"") +
                          (buttonStyle == ButtonStyle.Standard ? $"\nBackground=\"{BtnCustom.Background.ToColor().ToHexString()}\"" : "") +
                          (buttonStyle == ButtonStyle.Standard ? "" : $"\nBorderBrush=\"{BtnCustom.BorderBrush.ToColor().ToHexString()}\"") +
                          (buttonStyle == ButtonStyle.Standard ? "" : $"\nForeground=\"{BtnCustom.Foreground.ToColor().ToHexString()}\"") +
                          $"\npu:ButtonHelper.HoverBrush=\"{ButtonHelper.GetHoverBrush(BtnCustom).ToColor().ToHexString(false)}\"" +
                          (cornerRadius == 0 ? "" : $"\npu:ButtonHelper.CornerRadius=\"{cornerRadius}\"") +
                          " />";
        }
Exemplo n.º 3
0
        private void UpdateCode()
        {
            var buttonStyle  = ButtonHelper.GetButtonStyle(BtnCustom);
            var cornerRadius = SldCornerRadius.Value;
            var isWaiting    = ButtonHelper.GetIsWaiting(BtnCustom);
            var isSink       = ButtonHelper.GetClickStyle(BtnCustom);

            TbCode.Text = "<Button  Height=\"30\"" +
                          $"\nWidth=\"{BtnCustom.Width}\"" +
                          $"\nContent=\"{BtnCustom.Content}\"" +
                          (BtnCustom.Width < 60 ? $"\npu:ButtonHelper.WaitingContent=\"{{x:Null}}\"" : "") +
                          (isSink == ClickStyle.Sink ? $"\npu:ButtonHelper.ClickStyle=\"Sink\"" : "") +
                          (isWaiting ? $"\npu:ButtonHelper.IsWaiting=\"True\"" : "") +
                          "\nFontFamily=\"{StaticResource FontAwesome}\"" +
                          (buttonStyle == ButtonStyle.Standard ? "" : $"\npu:ButtonHelper.ButtonStyle=\"{buttonStyle}\"") +
                          (buttonStyle == ButtonStyle.Standard ? $"\nBackground=\"{BtnCustom.Background.ToColor().ToHexString()}\"" : "") +
                          (buttonStyle == ButtonStyle.Standard ? "" : $"\nBorderBrush=\"{BtnCustom.BorderBrush.ToColor().ToHexString()}\"") +
                          (buttonStyle == ButtonStyle.Standard ? "" : $"\nForeground=\"{BtnCustom.Foreground.ToColor().ToHexString()}\"") +
                          $"\npu:ButtonHelper.HoverBrush=\"{ButtonHelper.GetHoverBrush(BtnCustom).ToColor().ToHexString(false)}\"" +
                          (cornerRadius == 0 ? "" : $"\npu:ButtonHelper.CornerRadius=\"{cornerRadius}\"") +
                          " />";
        }