增加 Windows Phone 8 进度条中点的大小 [英] Increase size of Dots in Progress bar windows phone 8

查看:55
本文介绍了增加 Windows Phone 8 进度条中点的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想像这样显示进度条椭圆,而不是它的默认大小:增加不确定进度点大小的高度.

I wanted to display Progress bar Ellipse more that its Default size like this : increase height of indeterminate progress dot size.

我已经通过了护目镜和许多问题和博客帖子,但找不到任何解决方案

I have gone through goggling and many Questions and Post of blogs but could not find any Solution

也已经看到了这个,但在我的情况下不起作用:

Already seen this also but not working in my case:

  1. 适用于 Windows Phone 的高性能 ProgressBar(性能进度条")
  2. WP7 中更粗的 ProgressBar,怎么样?

推荐答案

如果你不介意一些 Overrides :)

If you don't mind a few Overrides :)

我已经对大多数常用控件进行了大量修改,以尽可能使用一点 XAML 来获得我所追求的外观.这是我用来满足你想要做的事情的早期进度条的剪切和粘贴.

I've heavily modified most of the common controls to get the look I'm after with a little XAML as possible. Here's a cut and paste from a earlier progress bar I was using to meet what you want to do.

XAML 命名空间

<phone:PhoneApplicationPage
 xmlns:MyControl="clr-namespace:MyOverrideConrols"    
>



C# 进度条覆盖



C# Progress Bar Override

namespace MyOverrideConrols
{
    public class MyProgressBar : ProgressBar
    {
        public MyProgressBar()
            : base()
        {
            this.NewDotSize = 20;
        }
        public MyProgressBar(int dot_size = 20)
            : base()
        {

            this.NewDotSize = (dot_size <= 0) ? 1 : dot_size;
        }

        public int NewDotSize{ get; set; }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            Rectangle slider_0 = (Rectangle)this.GetTemplateChild("Slider0"); ResizeRectangle(ref slider_0, NewDotSize);
            Rectangle slider_1 = (Rectangle)this.GetTemplateChild("Slider1"); ResizeRectangle(ref slider_1, NewDotSize);
            Rectangle slider_2 = (Rectangle)this.GetTemplateChild("Slider2"); ResizeRectangle(ref slider_2, NewDotSize);
            Rectangle slider_3 = (Rectangle)this.GetTemplateChild("Slider3"); ResizeRectangle(ref slider_3, NewDotSize);
            Rectangle slider_4 = (Rectangle)this.GetTemplateChild("Slider4"); ResizeRectangle(ref slider_4, NewDotSize);
            Rectangle slider_5 = (Rectangle)this.GetTemplateChild("Slider5"); ResizeRectangle(ref slider_5, NewDotSize);

        }

        private void ResizeRectangle(ref Rectangle rect, int new_size)
        {
            if (rect == null)
                return;
            rect.Width = new_size;
            rect.Height = new_size;
        }
    }
}



如何使用



How To Use

<MyControl:MyProgressBar IsIndeterminate="True" Height="25" NewDotSize="20"></MyControl:MyProgressBar>

<小时>

进度条在行动


Progress Bar In Action

这篇关于增加 Windows Phone 8 进度条中点的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆