I can’t set programmatically this binding:
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<i:InvokeCommandAction Command="{Binding Path=Document.MyDelegateCommandProperty}" />
</i:EventTrigger>
</i:Interaction.Triggers>
I tried with:
InvokeCommandAction ica = new InvokeCommandAction();
Binding actionCommandBinding = new Binding("Document.MyDelegateCommandProperty");
BindingOperations.SetBinding(ica, InvokeCommandAction.CommandProperty, actionCommandBinding);
System.Windows.Interactivity.EventTrigger eventTrigger = new System.Windows.Interactivity.EventTrigger("MouseLeftButtonDown");
eventTrigger.Actions.Add(ica);
eventTrigger.Attach(myUiElement);
Anyone can help?
Never used
Bindingin code but according to MSDN example for Binding class you must set theBinding.Sourcepropertyand you just passing
stringin constructor without source object/Datacontext.Is this post was helpful for you ?