Hi,
Am trying to use the ZoomChanged and ZoomingFinished events. But for some reason the events do not fire. Am using MVVM model for my application and Expression Blend interactions for handling events. I have created a sample application.
XAML:
<UserControl x:Class="TestRadMapZoomChangedEvent.Views.MapView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:controlsInputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
mc:Ignorable="d"
DataContext="{Binding Source={StaticResource Locator}, Path=MapViewModel}">
<Grid x:Name="LayoutRoot" Background="White">
<telerik:RadMap MiniMapExpanderVisibility="Collapsed" UseSpringAnimations="True">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ZoomingFinished">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="OnRadMapZoomingFinished"/>
</i:EventTrigger>
<i:EventTrigger EventName="ZoomChanging">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="OnRadMapZoomChanging"/>
</i:EventTrigger>
<i:EventTrigger EventName="ZoomChanged">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="RadMap_ZoomChanged"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</telerik:RadMap>
</Grid>
</UserControl>
ViewModel:
public class MapViewModelClass
{
public MapViewModelClass() { }
public void RadMap_ZoomingFinished(object sender, RoutedEventArgs e)
{
MessageBox.Show("From Zooming Finished");
}
public void RadMap_ZoomChanging(object sender, PropertyChangingEventArgs e)
{
MessageBox.Show("From Zoom Changing");
}
public void RadMap_ZoomChanged(object sender, EventArgs args)
{
MessageBox.Show("From Zoom Changed");
}
}
The "ZoomChanging" event fires, but neither of the ZoomChanged and ZoomingFinished events fire. These events fire from the code behind file. But when I use the same methods in the Viewmodel class, they do not fire. For ZoomChanged event, I get an exception saying "Could not find method named RadMap_ZoomChanged on object of type MapViewModelClass that matches the expected signature." and the application crashes immediately after that. Am not sure where am I going wrong? Can someone help me on this?
Am using the Telerik RadControls for Silverlight Q2 2012 SP2.
Thanks,
V.
Am trying to use the ZoomChanged and ZoomingFinished events. But for some reason the events do not fire. Am using MVVM model for my application and Expression Blend interactions for handling events. I have created a sample application.
XAML:
<UserControl x:Class="TestRadMapZoomChangedEvent.Views.MapView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:controlsInputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
mc:Ignorable="d"
DataContext="{Binding Source={StaticResource Locator}, Path=MapViewModel}">
<Grid x:Name="LayoutRoot" Background="White">
<telerik:RadMap MiniMapExpanderVisibility="Collapsed" UseSpringAnimations="True">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ZoomingFinished">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="OnRadMapZoomingFinished"/>
</i:EventTrigger>
<i:EventTrigger EventName="ZoomChanging">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="OnRadMapZoomChanging"/>
</i:EventTrigger>
<i:EventTrigger EventName="ZoomChanged">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="RadMap_ZoomChanged"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</telerik:RadMap>
</Grid>
</UserControl>
ViewModel:
public class MapViewModelClass
{
public MapViewModelClass() { }
public void RadMap_ZoomingFinished(object sender, RoutedEventArgs e)
{
MessageBox.Show("From Zooming Finished");
}
public void RadMap_ZoomChanging(object sender, PropertyChangingEventArgs e)
{
MessageBox.Show("From Zoom Changing");
}
public void RadMap_ZoomChanged(object sender, EventArgs args)
{
MessageBox.Show("From Zoom Changed");
}
}
The "ZoomChanging" event fires, but neither of the ZoomChanged and ZoomingFinished events fire. These events fire from the code behind file. But when I use the same methods in the Viewmodel class, they do not fire. For ZoomChanged event, I get an exception saying "Could not find method named RadMap_ZoomChanged on object of type MapViewModelClass that matches the expected signature." and the application crashes immediately after that. Am not sure where am I going wrong? Can someone help me on this?
Am using the Telerik RadControls for Silverlight Q2 2012 SP2.
Thanks,
V.