2011-08-18 44 views
0

如何组合两个活动并创建新活动?wpf联合活动

例如:如果鼠标离开控件并将焦点放在另一个控件上(使焦点丢失),则触发事件custom_event。

我是WPF新手,我还没有完成wpf的禅宗。如果还有其他方法可以做到这一点,请告诉我。

+0

特定控制的LostFocus事件已经为你做这个例子。 – CharithJ

+0

LostFocus在用户控件上无法正常工作。 – icaptan

回答

2

有可能在XAML与MultiDataTriggers,看到这个article from Josh Smith:

<!-- This MultiDataTrigger affects losers of the race. --> 
<MultiDataTrigger> 
    <MultiDataTrigger.Conditions> 
    <Condition Binding="{Binding IsFinished}" Value="True" /> 
    <Condition Binding="{Binding IsWinner}" Value="False" /> 
    </MultiDataTrigger.Conditions> 

    <!-- Apply the "finished the race" brush to 
     the horse's progress indicator. --> 
    <Setter TargetName="progressIndicator" 
      Property="Fill" Value="{StaticResource FinishedBrush}" /> 

    <!-- Fade the race pit in and out if the horse lost the race. --> 
    <MultiDataTrigger.EnterActions> 
    <!-- Fade away the RaceHorse's Border element when it loses a race. --> 
    </MultiDataTrigger.EnterActions> 

    <MultiDataTrigger.ExitActions> 
    <!-- Fade in the RaceHorse's Border element when a new race starts. --> 
    </MultiDataTrigger.ExitActions> 
</MultiDataTrigger> 
+0

感谢您的答案,我不能选择答案作为缺乏声誉的真正原因,所以我记起了upvoted。现在我可以:)谢谢! (我在我的信息页面上方看到一个红色的句子,感谢您的警告) – icaptan