コード例 #1
0
        private void UpdateCode()
        {
            var pgStyle         = ProgressBarHelper.GetProgressBarStyle(PgbCustom);
            var value           = _usingAnimation ? ProgressBarHelper.GetAnimateTo(PgbCustom) : PgbCustom.Value;
            var isIndeterminate = PgbCustom.IsIndeterminate;
            var cornerRadius    = SldCornerRadius.Value;
            var percentVisible  = ProgressBarHelper.GetIsPercentVisible(PgbCustom);

            TbCode.Text = $"<ProgressBar  Height=\"{PgbCustom.Height}\"" +
                          $"\nWidth=\"{PgbCustom.Width}\"" +
                          (pgStyle == ProgressBarStyle.Standard ? "" : $"\npu:ProgressBarHelper.ProgressBarStyle=\"{pgStyle}\"") +
                          (pgStyle == ProgressBarStyle.Standard ? $"\nBackground=\"{PgbCustom.Background}\"" : $"\nBorderBrush=\"{PgbCustom.BorderBrush}\"") +
                          $"\nForeground=\"{PgbCustom.Foreground}\"" +
                          (value == 0 ? "" : _usingAnimation ? $"\npu:ProgressBarHelper.AnimateTo=\"{value}\"" : $"\nValue=\"{value}\"") +
                          (cornerRadius == 0 ? "" : $"\npu:ProgressBarHelper.CornerRadius=\"{cornerRadius}\"") +
                          (isIndeterminate ? "\nIsIndeterminate=\"True\"" : "") +
                          (percentVisible ? "\npu:ProgressBarHelper.IsPercentVisible=\"True\"" : "") +
                          " />";
        }
コード例 #2
0
        private void UpdateTemplate()
        {
            var color = Helper.GetColorByOffset(_linearGradientBrush.GradientStops, SldTheme.Value / 7);

            ProgressBarHelper.SetCornerRadius(PgbCustom, SldCornerRadius.Value);

            if (_usingAnimation)
            {
                ProgressBarHelper.SetAnimateTo(PgbCustom, SldProgress.Value);
            }
            else
            {
                PgbCustom.Value = SldProgress.Value;
            }

            switch (ProgressBarHelper.GetProgressBarStyle(PgbCustom))
            {
            case ProgressBarStyle.Standard:
                PgbCustom.Background = new Color()
                {
                    A = 30, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                PgbCustom.BorderBrush = Colors.Transparent.ToBrush();
                PgbCustom.Foreground  = color.ToBrush();
                break;

            case ProgressBarStyle.Ring:
                PgbCustom.Background  = Colors.White.ToBrush();
                PgbCustom.BorderBrush = new Color()
                {
                    A = 30, R = color.R, G = color.G, B = color.B
                }.ToBrush();
                PgbCustom.Foreground = color.ToBrush();
                break;
            }
        }