Silverlight 3.0: How to bind DataGridColumn to an ICommand wherein the DataGrid is bound to an ItemsSource

494 Views Asked by At

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...

1

There are 1 best solutions below

0
On