.NET Blog

Tony Cavaliere

 
My Favourite Albums
  And the Grappa wins.
E-mail me Send mail

Disclaimer

Hey unlike other bloggers I stand by what I say but just in case. The opinions expressed herein are my own except on Tuesday when the second card is not turned up otherwise it ain't worth squat.

© Copyright 2012

Silverlight: Finding the default style

One of the things I like about Silverlight is the ability to customize existing controls. Just about every control that ships with Silverlight has a default style. You are free to override the default style, create a new style from scratch or if you so choose edit a copy of the default style. Using the new style is as simple as setting the Style attribute  Style="{StaticResource StyleName} where StyleName is the name of the style. For further information on styling refer to the following post.

But where can you find the default style for a control?

Excluding third party tools, I know of at least three ways;

1. From the Silverlight Documentation

If you haven't done so then download the offline Silverlight documentation. The default styles for the Silverlight controls are published in this document.

SL Doco Button Style

2. Use Blend

The second way is to use blend. All you need to do is select the control and right click and choose Edit Control Parts (Template)->Edit Copy. This will create a copy of the default style and attach it the control.

blend button style

3. .NET Reflector (Before you begin I realize this is a third party tool, but it's my blog and I use it so much it doesn't feel like one anymore)

The final method is to use everybody's friend, .NET Reflector. Find the assembly for the control. For example, if you are wanting the default style for say a button then add the following assembly to .NET reflector.

C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Reference Assemblies\System.Windows.dll

Next navigate to the Systems.Windows->Resource->System.Windows.g.resources node and double click it. After doing so you .NET Reflector will appear similar to the the following

NET reflector style

Next double click the XAML file in the disassembler pane. Provider you have associated the XAML file extension with the VS2008 executable you should see the default styles for all the controls in that assembly, similar to the figure below. Note the default file association for XAML is IE which does not render the XAML correctly.

VS2008 XAML

Which method do I prefer? The first will only work with the documentation and the code are in sync. Both Blend and Reflector will produce styles that are in sync with the code, however, Blend is not free and not every developer will have a copy. Need I say more.

Guess the movie

Seventeen *days?* Hey man, I don't wanna rain on your parade, but we're not gonna last seventeen *hours!* Those things are gonna come in here just like they did before. And they're gonna come in here...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Silverlight
Posted by CynotWhyNot on Saturday, November 15, 2008 5:57 PM
Permalink | Comments (56) | Post RSSRSS comment feed

Related posts

Comments

Rocky Moore us

Sunday, November 16, 2008 3:12 AM

Rocky Moore

I keep hopying Microsoft will add most of Blend's ability to VS like they did with Expression Web. From the sounds of all the new they are supposedly adding to Blend this next year, I figure integration with VS will be another version beyond the 2010 issue.

Guess the movie:

Aliens maybe?

Tony Cavaliere us

Tuesday, November 18, 2008 4:09 PM

Tony Cavaliere

I just read scottgu's posting and it sounds like blend within VS is coming soon. Great news!

Aliens is the movie. Congrats!

Rocky Moore us

Tuesday, November 18, 2008 6:57 PM

Rocky Moore

Thanks for the notice! How cool is that! Hard to wait until next year now, oh well a lot to learn with SL2 anyway ;)

Busby SEO Test us

Monday, January 19, 2009 11:59 PM

Busby SEO Test

Hellow, nice blog, tnx for the information......nice idea

Perfect Home Design us

Thursday, March 12, 2009 7:25 AM

Perfect Home Design

im looking that before

designer handbags US

Thursday, May 27, 2010 2:34 PM

designer handbags

There are certainly a lot of details like that to take into consideration. That is a great point to bring up. I offer the thoughts above as general inspiration but clearly there are questions like the one you bring up where the most important thing will be working in honest good faith. I don?t know if best practices have emerged around things like that, but I am sure that your job is clearly identified as a fair game.

prosta delovna mesta us

Wednesday, September 22, 2010 3:36 AM

prosta delovna mesta

gieleibzllbqrkvblcyy, http://honorar.si, DFLCKfU.

pantene pro v us

Sunday, October 03, 2010 9:06 PM

pantene pro v

klsiizeuegubpcb, <a href="http://honorar.si">zaposlitev</a>, MfockuaCcxDIfjNDFObZ.

mattress topper us

Monday, October 04, 2010 12:42 PM

mattress topper

toyzvlkihsjdsds, <a href="http://williamrast.org">william rast</a>, AqzipiBGIjiXpYNUlHAf.

pantene pro v us

Wednesday, October 06, 2010 11:45 AM

pantene pro v

yiahdmqkmhdxshe, <a href="http://honorar.si">zaposlitev</a>, myiEiPNnOGfryItNkwOc.

garnier nutrisse us

Wednesday, October 06, 2010 10:14 PM

garnier nutrisse

jlcydozomrbkbdtetmob, http://honorar.si zaposlitev , cKOAIdkYoHUTDtbxaw. ilafdxldmajixagdkovo, http://panteneprov.org pantene pro v , xPuLOtGbhXPyfYMXoR.

kate spade us

Thursday, October 07, 2010 1:12 PM

kate spade

ldsyqfbvlmjnunsgylci, http://kathyvanzeeland.org kathy van zeeland , QJYWrfVdTfpEkfieJM. jrwbnjgkynomhtuupyvw, http://honorar.si zaposlitev , SpKoGObBEITtOQFJcp.

Compact refrigerator us

Sunday, October 10, 2010 11:30 PM

Compact refrigerator

The site looks kinda bad on my phone =(

paul smith wallet us

Monday, October 11, 2010 10:46 AM

paul smith wallet

rkrgkygzeqachthciy, http://earnestsewn.org, OfczqBAJVpvJsJFtUNzZ. uomclqkngyjrrkwnmc, http://southshorefurniture.org, iHLTqmyTVuyaBrTCrABF.

Winter anime girls winter dreamsyume no ato us

Monday, October 11, 2010 10:26 PM

Winter anime girls winter dreamsyume no ato

Its a pity you dont have a donate button, i would donate some =)

jack3d us

Tuesday, October 12, 2010 3:27 PM

jack3d

hdpasayebgcspxxery, http://www.usp-jack3d.com , NeaKsBAPsNZMitSFsvwn.

biorhythm afterglow reviews us

Thursday, October 14, 2010 8:35 AM

biorhythm afterglow reviews

pcltjincwxehugdyrt, http://biorhythm-androbolix.co.uk , EbZktWbjnIRusFuxhkWm.

wholesale supplements supplier us

Tuesday, October 19, 2010 9:38 AM

wholesale supplements supplier

mwfmqflrkjbumswnph, http://www.physique-wholesale.com , FRHcfHEnsRQjdQcbDJgb.

Lower body workout leg and core exercises us

Monday, October 25, 2010 9:40 AM

Lower body workout leg and core exercises

This site is cool. i visit here evaryday.

Mandy Moore (4) HD Wallpaper us

Monday, October 25, 2010 9:49 PM

Mandy Moore (4) HD Wallpaper

Great site design!!!! Whattemplate did you use?

Facebook statuses us

Tuesday, October 26, 2010 5:04 PM

Facebook statuses

Thanks for posting this. i really enjoyed reading this.

Emo us

Tuesday, October 26, 2010 9:28 PM

Emo

Its a pity you dont have a donate button, i would donate some =)

Compact refrigerator us

Wednesday, October 27, 2010 6:46 PM

Compact refrigerator

Thanks for posting this. i really enjoyed reading this.

Cross cutting shredder us

Thursday, October 28, 2010 4:33 AM

Cross cutting shredder

This site is great. i visit here evaryday.

Wowwee fairy godfather animated computer personality us

Thursday, October 28, 2010 2:40 PM

Wowwee fairy godfather animated computer personality

This site is cool. i visit here evaryday.

Time and the gods us

Friday, October 29, 2010 1:41 AM

Time and the gods

This site is cool. i visit here evaryday.

Video karate lessons how to tie a karate belt for beginners

Where is your rss? I cant find it

Cross cutting shredder us

Sunday, November 07, 2010 5:57 AM

Cross cutting shredder

Hey check out my blog too. I hope i have some fun stuff too

Usb power adapter y cable us

Sunday, November 07, 2010 1:28 PM

Usb power adapter y cable

Its a pity you dont have a donate button, i would donate some =)

High druid of shannara straken us

Sunday, November 07, 2010 4:26 PM

High druid of shannara straken

Its a pity you dont have a donate button, i would donate some =)

Dating tips for guys what guys need to know about dating

I liked this post

Ducati Monster 1100 Metallic Mix HD Wallpaper us

Sunday, November 07, 2010 10:49 PM

Ducati Monster 1100 Metallic Mix HD Wallpaper

Hey check out my blog too. I hope i have some cool stuff too

Facebook statuses us

Monday, November 08, 2010 1:33 AM

Facebook statuses

Its a pity you dont have a donate button, i would donate some =)

Emo us

Monday, November 08, 2010 4:26 AM

Emo

Thanks for posting this. i really enjoyed reading this.

Compact refrigerator us

Monday, November 08, 2010 7:14 AM

Compact refrigerator

Great site design!!!! Whattheme did you use?

Cross cutting shredder us

Monday, November 08, 2010 10:00 AM

Cross cutting shredder

Hey check out my blog too. I hope i have some interesting stuff too

F 15 Eagle joined F 16 Fighting Falcons HD Wallpaper us

Sunday, December 05, 2010 5:45 PM

F 15 Eagle joined F 16 Fighting Falcons HD Wallpaper

Its a pity you dont have a donate button, i would donate some =)

Facebook statuses us

Monday, December 06, 2010 4:38 PM

Facebook statuses

This site is cool. i visit here evaryday.

Facebook statuses us

Monday, December 06, 2010 11:25 PM

Facebook statuses

I loved this post

Emo us

Tuesday, December 07, 2010 5:41 AM

Emo

This site is cool. i visit here evaryday.

Compact refrigerator us

Tuesday, December 07, 2010 4:29 PM

Compact refrigerator

I loved this article

Compact refrigerator us

Tuesday, December 07, 2010 10:37 PM

Compact refrigerator

This site is cool. i visit here evaryday.

Cross cutting shredder us

Wednesday, December 08, 2010 5:07 AM

Cross cutting shredder

Great site design!!!! Whattemplate did you use?

Elva egf perfection bb cream 50g us

Wednesday, December 08, 2010 11:29 AM

Elva egf perfection bb cream 50g

Its a pity you dont have a donate button, i would donate some =)

Armed magical us

Thursday, December 09, 2010 5:19 AM

Armed magical

Where is your rss? I cant find it

Nikon 5811 coolpix leather case for selected s series cameras

This site is cool. i visit here evaryday.

Mac os 9 2 and later linux us

Friday, December 10, 2010 12:33 AM

Mac os 9 2 and later linux

Its a pity you dont have a donate button, i would donate some =)

My contest entry to mishyb1979s contest us

Friday, December 10, 2010 6:19 AM

My contest entry to mishyb1979s contest

Its a pity you dont have a donate button, i would donate some =)

Facebook statuses us

Monday, December 13, 2010 3:53 AM

Facebook statuses

Where is your rss? I cant find it

Emo us

Monday, December 13, 2010 1:02 PM

Emo

Its a pity you dont have a donate button, i would donate some =)

Compact refrigerator us

Tuesday, December 14, 2010 12:01 AM

Compact refrigerator

Great site design!!!! Whattheme did you use?

Cross cutting shredder us

Tuesday, December 14, 2010 9:10 AM

Cross cutting shredder

Its a pity you dont have a donate button, i would donate some =)

Delhi india us

Saturday, December 25, 2010 8:15 PM

Delhi india

Its a pity you dont have a donate button, i would donate some =)

Faith facebook statuses us

Sunday, December 26, 2010 4:58 AM

Faith facebook statuses

Hey check out my blog too. I hope i have some interesting stuff too

Faiths avatars us

Sunday, December 26, 2010 3:03 PM

Faiths avatars

Great site design!!!! Whattemplate did you use?