1.14.2016

Events als Behaviors / Events in MVVM

Für WPF:
Verweis auf Microsoft.XAML.Interactions notwendig
...
xmlns:i=http://schemas.microsoft.com/expression/2010/interactivity
...
<i:Interaction.Triggers>


<i:EventTrigger EventName="Loaded">


<i:InvokeCommandAction Command="{Binding LoadedCommand}" />


</i:EventTrigger>


</i:Interaction.Triggers>


Für WinPhone 8.1:
Verweis auf Behaviors SDK (XAML)
...
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"


xmlns:core="using:Microsoft.Xaml.Interactions.Core"
...
<interactivity:Interaction.Behaviors>


<core:EventTriggerBehavior EventName="Tapped">


<core:InvokeCommandAction Command="{Binding RufeNummerAnCommand, Mode=OneWay}"/>


</core:EventTriggerBehavior>


</interactivity:Interaction.Behaviors>

Keine Kommentare: