icaptan
icaptan

Reputation: 1535

wpf combine events

How can I combine two events and create a new event ?

e.g : if the mouse leave the control and focus on another control (so that focus is lost) then fire event custom_event.

I'm new at WPF and I've got not complete the zen of wpf. If there is another way to do that, let me know.

Upvotes: 0

Views: 356

Answers (1)

Amittai Shapira
Amittai Shapira

Reputation: 3827

It's possible in XAML with MultiDataTriggers, see this 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>

Upvotes: 2

Related Questions