2011-08-18 2 views
0

어떻게 두 개의 이벤트를 결합하고 새 이벤트를 만들 수 있습니까?wpf 이벤트 결합

예 : 마우스가 다른 컨트롤에 포커스를두고 포커스를 잃어 버리면 마우스 이벤트가 custom_event 이벤트를 발생시킵니다.

저는 WPF에서 새로운데 wpf의 선을 완성하지 못했습니다. 그렇게 할 수있는 또 다른 방법이 있다면 알려주십시오.

+0

LostFocus 이벤트가 이미 당신을 위해 예를 수행하십시오. – CharithJ

+0

사용자 컨트롤에서 LostFocus가 제대로 작동하지 않습니다. – icaptan

답변

2

그것은 MultiDataTriggers와 XAML에서 가능하다, 특정 컨트롤이 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