Hi,
I'm using this workaround to get a CommandProperty for mouse actions such as a left double click: http://www.wpfmentor.com/2009/01/how-to-add-binding-to-commandparameter.html
It works fine...
I'd like to use that workaround with a DataTemplate but {Binding Path=ID} doesn't seem to work for the DataResource.BindingTarget as it does for i.e. TextBlock.Text:
<ListBox x:Name="lst">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type my:Person}">
<DataTemplate.Resources>
<my:DataResource x:Key="myid" BindingTarget="{Binding Path=ID}"/>
</DataTemplate.Resources>
<TextBlock Text="{Binding Path=ID}">
<TextBlock Text="{StaticResource myid}">
<TextBlock.InputBindings>
<MouseBinding
Command="ApplicationCommands.Open"
MouseAction="LeftDoubleClick">
<MouseBinding.CommandParameter>
<my:DataResourceBinding DataResource="{StaticResource myid}"/>
</MouseBinding.CommandParameter>
</MouseBinding>
</TextBlock.InputBindings>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
The Person class is just a class with one property and a few of them in a List(Of Person) attacht to the ListBox as ItemsSource.
Does anyone see what I'm doing wrong?
Thanks in advance...