Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

c# - Increase size of Dots in Progress bar 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. The high performance ProgressBar for Windows Phone (“PerformanceProgressBar”)
  2. A thicker ProgressBar in WP7, how?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you don't mind a few Overrides :)

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 Namespace


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



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

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...