views:

251

answers:

1

I have a SL3 DataGrid bound to a collection. One column of the datagrid is a HyperlinkButton column and I want to bind the click event of the column to an ICommand present in the VM.

pseudo code:

DataGrid ItemsSource="{Binding someCollection}" DataGridHyperLinkColumn Commands.Command="{Binding myClickCommand}"

Now in this scenario the Commands.Command is trying to locate the myClickCommand within the someCollection instead of getting it from the VM myClickCommand property.

I have also tried the fix Commands.Command="{Binding Path=DataContext.myClickCommand, ElementName=nameOfUserControl}" but that fails as well.

What is the way out...? I don't want to use BindingHelper since SL3 already supports ElementBinding...

A: 

voila...there is a solution already available from Dan Wahlin out here: http://weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-data-binding-in-nested-controls.aspx

sl_developer