SharePointAds TextOnly

Thursday, 11 February 2010

Silverlight: How to change color style for progress bar?



In silverlight we can use progress bar control, but it's default template is with little light colors.



in this progress control use forground = "Red" but in this control this color look very lighter than original. So what to do if we want to use original solid html colors?

I tried with different methods like using



1. MyAverageBar.Foreground = new SolidColorBrush(Colors.Red);

2.
MyAverageBar.Foreground = new SolidColorBrush(Color.FromArgb(255,255,0,0));

but actually its styling problem.

How to change default Style of progress bar?

I changed default style using Microsoft Expression Blend! (Blend is useful in those perpose means we can do this thing in Visual studio also but this is with long process... so blend is easier)

Follow the following steps:

  1. Open XAML file in Blend!
  2. Right click on your progress control bar and select Edit Template > Edit a Copy.
  3. It will open new window to allow to create style resource
  4. Change 'This document' option from 'Define In' section, click on dropdown and select progress bar control
  5. Click on OK
  6. Then again click on Progress bar control
  7. From properties window clickFill style in Brushes section, it will open new menu and then select 'Reset' menu.
  8. press Cntr+S (save xaml file)
With this style it will remove default color style



Now Progress bar control looks like above.. :)







2 comments:

  1. yes give me more explanation.i cannot getting you.give step by step explanation please.

    ReplyDelete