7 Answers, 1 is accepted
0
Hi Finbarr,
Yes, it is possible. You can use the RadMap.MapMouseClick event.
I would recommend to take a look at the following online example:
http://demos.telerik.com/silverlight/#Map/DataBinding
Regards,
Andrey Murzov
Telerik
Yes, it is possible. You can use the RadMap.MapMouseClick event.
I would recommend to take a look at the following online example:
http://demos.telerik.com/silverlight/#Map/DataBinding
Regards,
Andrey Murzov
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0

Finbarr
Top achievements
Rank 1
answered on 12 Jun 2013, 08:55 AM
Sorry,I want to fire a command in my viewmodel when the mouse is clicked?
0
Hi Finbarr,
You can create a method in your viewmodel. And you can invoke it in the handler of the RadMap.MapMouseClick event.
Regards,
Andrey Murzov
Telerik
You can create a method in your viewmodel. And you can invoke it in the handler of the RadMap.MapMouseClick event.
Regards,
Andrey Murzov
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0

Gauthier
Top achievements
Rank 1
answered on 11 Sep 2013, 03:22 PM
Unfortunately, I don't see this as a real solution.
You have to write code in the codebehind of your view (or usercontrol), which should be avoided in a clean MVvM approach.
(Testability ? , 'Blendability ?', ....)
For a map control, it appears so common that we need to now the coordinates clicked by the user, I would expect that it is feasible to really bind a command on the viewmodel, and not having to handle an event in the codebehind.
You have to write code in the codebehind of your view (or usercontrol), which should be avoided in a clean MVvM approach.
(Testability ? , 'Blendability ?', ....)
For a map control, it appears so common that we need to now the coordinates clicked by the user, I would expect that it is feasible to really bind a command on the viewmodel, and not having to handle an event in the codebehind.
0
Hello Gauthier,
I am afraid RadMap doesn't expose any commands which can be handled in your model. Only events are available.
Best regards,
Andrey Murzov
Telerik
I am afraid RadMap doesn't expose any commands which can be handled in your model. Only events are available.
Best regards,
Andrey Murzov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0

Stuart
Top achievements
Rank 1
answered on 16 Sep 2013, 01:56 PM
Hi Gauthier,
The interactivity library can solve this problem:
1. Download "System.Windows.Interactivity.WPF" from NuGet.
2. Add a command to your ViewModel
3. Add an interaction trigger to your RadMap to fire your command on click:
<i:Interaction.Triggers>
<i:EventTrigger EventName="MapMouseClick">
<i:InvokeCommandAction Command="{Binding ClickedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
Regards,
Stuart
The interactivity library can solve this problem:
1. Download "System.Windows.Interactivity.WPF" from NuGet.
2. Add a command to your ViewModel
3. Add an interaction trigger to your RadMap to fire your command on click:
<i:Interaction.Triggers>
<i:EventTrigger EventName="MapMouseClick">
<i:InvokeCommandAction Command="{Binding ClickedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
Regards,
Stuart
0
Hello Stuart,
Unfortunately your approach will not work in this case. The InvokeCommandAction can't pass event arguments as command parameters. But arguments of the RadMap.MapMouseClick event contains geographical location of the place where mouse button has been clicked. It is very important to pass it to the command. The alternative is creation of own behavior. You can find samples in the Internet. For example, here:
http://stackoverflow.com/a/16317999/677857
Regards,
Andrey Murzov
Telerik
Unfortunately your approach will not work in this case. The InvokeCommandAction can't pass event arguments as command parameters. But arguments of the RadMap.MapMouseClick event contains geographical location of the place where mouse button has been clicked. It is very important to pass it to the command. The alternative is creation of own behavior. You can find samples in the Internet. For example, here:
http://stackoverflow.com/a/16317999/677857
Regards,
Andrey Murzov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>