attachedbindings for silverlight 5

Posted by Karim on September 22, 2008

Today I released a small pet project of mine on Codeplex, called AttachedBindings. It’s a library for Silverlight which attempts to bridge the feature gap of Bindings between Silverlight and WPF. It contains an attached behavior that implements a form of ElementName Binding between two FrameworkElements.

Here is a simple example, which shows a Calendar control that changes opacity when Slider.Value changes.

<e:Calendar ab:AttachedBinding.Binding=
    "TargetProperty=Opacity, ElementName=OpacitySlider, Path=Value"/>
<Slider x:Name="OpacitySlider" Minimum="0" Maximum="1"
    SmallChange="0.1" LargeChange="0.1" Value="1.0"/>

Enjoy!

Disclaimer : Thanks go to Neil Mosafi, his ElementNameBinder was first on the scene. I reasoned an Attached Behavior with a custom TypeConverter would be easier to use, and I was able to make some optimizations along the way.