Tuesday, April 26, 2011

A lovely feature of Silverlight 5 beta

Just saw this on Mike Taulty's blog. The ability to create your own custom markup extensions. The thing I like the most about this is being able to abreviate the common binding syntax that I seem to be using a lot:


public class StandardTwoWayBindingExtension : Binding  
  public StandardTwoWayBindingExtension()  
    this.ValidatesOnNotifyDataErrors = true;  
    this.NotifyOnValidationError = true;  
    this.Mode = BindingMode.TwoWay;        


    <local:DataObject />  
    Text="{local:StandardTwoWayBinding Path=SomeProperty}" />  

Head on over to the post to see it in action.