开发者

ControlStoryboardAction in the View that triggered by event in the ViewModel

开发者 https://www.devze.com 2023-03-23 12:41 出处:网络
<i:Interaction.Triggers> <i:EventTrigger EventName=\"DownloadStartedEvent\"> <ei:ControlStoryboardAction/>
<i:Interaction.Triggers>
   <i:EventTrigger EventName="DownloadStartedEvent">
       <ei:ControlStoryboardAction/>
   </i:EventTrigger>
<i:Interaction.Triggers>

DownloadStartedEvent is some public event on my ViewModel. I want this trigger on my Vie开发者_运维技巧w to start a StoryBoard when the DownloadStartedEvent on the ViewModel is fired. Is there a way to achieve that ?


It should work when you bind the EventName to the event of the DataContext (aka. your viewmodel)

<i:Interaction.Triggers>
  <i:EventTrigger EventName="{Binding DownloadStartedEvent}">
   <ei:ControlStoryboardAction/>
  </i:EventTrigger>
<i:Interaction.Triggers>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号