Saturday, December 15, 2007

CSS in Silverlight? Oh Yeah! Even Better? Hell Yeah!

CSS existence is quite ancient but the true potential of CSS was realised only for parsing XML elements. Ok we already know that and also that XAML is XML based or atleast the inspiration/syntax is, does it mean we can expect CSS type styling in XAML, if it can be used in XAML does it mean we can use it in Silverlight 2.0 applications?

Too many questions but a simple answer, CSS is thing of the past  with many issues like incompatible browsers, hard to retrofit, hard to learn, time consuming, pain staking need I say more? Next generation technology requires next generation style sheet format,  so please welcome XAML Resources.

XAML What?

You heard - XAML resources, providing style sheets in XAML format as simple as that. Wait a minute, does it mean we can design our own custom buttons or controls from a graphic designer in one XAML and use is across the applications?

Yes, how about an example?

<Page.Resources>
<SolidColorBrush x:Key="MyBrush" Color="Gold"/>
<Style TargetType="Border" x:Key="PageBackground">
<Setter Property="Background" Value="Blue"/>
</Style>

...

</Page.Resources>
<StackPanel>
<Border Style="{StaticResource PageBackground}">

...
</Border>

</StackPanel>


Is that it? What? How? When?



Yes that is it, want to learn How? Already in use in WPF applications. Silverlight 2.0 Beta supports it? Not sure ask Microsoft. Can we expect it? Yes we can, I give 4.7/5 for expectancy. 



Please leave your comments.






6 comments:

Edward J. Apostol said...

The issue is not the CSS standard itself, but the inability for the browser makes to live up to the W3C standard. Complicating the issue by creating proprietary XAML tags that describe a whole wealth of CSS implementation of look and feel just adds another unnecessary layer. I believe Adobe had it right by taking their existing CSS support and baking it in to work alongside the Flex/AIR framework.

Questions have been raised by my students (whom I am teaching Silverlight to) and while we await encouragingly for version 2.x of Silverlight, I don't think I can agree with the use of more proprietary mechanisms to render content when really a lot of corporations / clients would be happy to use their existing CSS and make it compatible with their RIAs.

kind regards,

Edward Apostol

Sonny King said...

Because we're not talking about CSS in a browser I think it's not valid to claim it's a thing of the past. A CSS systax implementation is much cleaner than the XAML resource model. There is a goo deal more code to XAML resources that to a standard CSS implementaion. My two pennys.

generic viagra said...

Its really an important post about silverlight..It will definitely help .net developer..Keep posting such useful information..

Anonymous said...

ha ha ha CSS is a thing of the past. More like silverlight is a thing of the past.

tienda erotica fleshlight said...

Hey, there is a great deal of effective info above!

muebles collado villalba said...

Goodness, there's really much effective info here!