Hi -
I am trying to get an event to fire via ViewModel when navigating away from a page and I did the following...
<navigation:Page xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:this="clr-namespace:DataOnline.RAM.DOLWebApp" xmlns:csla ="clr-namespace:Csla.Xaml;assembly=Csla.Xaml" xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:navigation ="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" x:Class="DataOnline.RAM.DOLWebApp.Views.Systems" x:Name="SystemPage" >
<navigation:Page.Resources>
<this:StatusViewModel x:Key="mySystemViewModel"/>
</navigation:Page.Resources>
<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource mySystemViewModel }}">
<csla:TriggerAction x:Name="StopTimerTrigger" MethodName="KillTimer" TriggerEvent="NavigatedFrom" TargetControl="{Binding ElementName =SystemPage}"/>
</Grid>
</navigation:Page>
public void KillTimer(object sender, Csla.Xaml.ExecuteEventArgs e)
{
}
The event “KillTimer” doesn’t get fired and I am wondering why.. Any ideas??
Thanks
Ranjini
I've never tried attaching a TriggerAction to the actual form/window/page. Maybe it just doesn't work to do that.
You might try stepping through the code in TriggerAction that sets and finds the source to see if it is able to find the source and set up the event handler - it is quite possible that this doesn't work for some reason.
Copyright (c) Marimer LLC