コード例 #1
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}\"") +
                          " />";
        }