Closed pedrollanes closed 3 years ago
Looks like a normal event: have you tried using an action with it?
(In future, please open questions as discussions. GitHub have removed the helpful button letting me turn issues into discussions however annoyingly)
Sorry I will do it in the future. I tried to use action but I recieved an error. I think that is an special event and a normal binding action doesn't work
What error did you get, exactly?
With this code
`
Aah, so it can't find the ActionTarget. It should have been able to get something from IRootObjectProvider
, but it seems not in this case. I'll have to look at why WPF is behaving that way. You can follow the instructions, and set s:View.ActionTarget
to your ViewModel.
I just tried to reproduce this and failed. From Stylet.Samples.Hello, I replaced the Button
with:
<Button Command="{s:Action SayHello}" Content="SayHello" Visibility="{Binding CanSayHello, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Completed="{s:Action Check}" Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:2.5" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
and add public void Check() { }
to the VM. The animation works, and Check
is correctly invoked at the end.
Please could you add a full repro?
OK, this afternoon I'll see and I tell you.
Ok I have inserted all content into a button and it works. But if i use in a grid doesn't work. I suppose its right. Thanks
Can you post a repro, please? That's not enough information for me to tell what's happening.
Ok the problem is that I was putting trigger in a style of a resource dictionary. When I put all the style in the button I have no problem.
Ah yeah, it will struggle to find the VM from a ResourceDictionary
Is there any way to bind a storyboard completed event?