Visual studio feeds

All Visual Studio blogs in one place


Enter your email address:

Delivered by FeedBurner

Increase your website traffic with



Anti-spam: How many eyes has a typical person?

Follow us on FB


Silverlight 5.0: Custom Markup Extensions and Roles

AddThis Social Bookmark Button
Starting from Silverlight 5.0 you can create custom Markup Extensions and this is an interesting feature to easily encapsulate some logic and make it easy to be applied to properties in the XAML markup. Until now you could only use a few extensions to apply resources (StaticResource), make databinding (Binding) and connect properties with parts of a template (TemplateBinding) but now, implementing a really simple interface you can build your own.
1: public interface IMarkupExtension where T:
class 2: { 3: T ProvideValue(IServiceProvider serviceProvider); 4: }
Using this interface you can specify the type to which the markup extension can be applied (the generic type T) but if you do not need a control about this type you can extend the MarkupExtension abstract class that is like you are extending IMarkupExtension. Inside the ProvideValue method there is the whole logic of the extension and using the...(Read whole news on source site)
Home : Blog List : Silverlight Playground : Silverlight 5.0: Custom Markup Extensions and Roles