views:

34

answers:

3

I know styling is possible in SL, but I have a large web app that has both HTML and SL so it would be really useful if they could use the same style sheet... Is it possible? Thanks.

+2  A: 

Silverlight is a Web application and not a Web form. You'd have to use the Resource.XAML file in order to apply styling to your Silverlight application.

Ardman
+1  A: 

I would have to say no. If for no other reason than Microsoft's poor track record in regards to CSS (even their leading browser generation is 10 years behind competing CSS implementations). The Word/Outlook engine is atrocious at CSS. If silverlight supports CSS you can bet it'll be a dog's breakfast.

On the other hand SVG supports CSS so you might want to look into that as an alternative.

SpliFF
+1 for dog's breakfast.
Kyle Sevenoaks
Ok, then maybe lets change the question to: Is it possible to have a seperate XAML style resource that can be imported into the SL app much like a CSS would into HTML? Because then for each theme I can have one CSS and one XAML. Make sense?
Matt
A: 

CSS and XAML are incompatible sadly. In Silverlight 'Stylesheets' are called ResourceDictionaries, which live in the Silverlight Project.

I created a free Silverlight theme which has several ResourceDictionaries, one for the colours (Brushes.xaml) and one to style the controls, it might be worth downloading the project to see how it works: http://www.blackspike.com/site/silverlight/free-silverlight-4-beta-skin

felixthehat