Hi. I have a Map Viewer for Silverlight running and functioning well. What i need is to add a measure tool so that the user could be able to measure distances on the map. I am not a programmer and i am new to this silverlight application. What i have to do?...any help is much appreciated. Thanks.:)
You can do it through an addin, but you would need to do some programming 😉 Here's an example...****Measure tool command class*** public class MeasureActionTool : ICommand
{
#region ICommand members
public void Execute(object parameter)
{
SolidColorBrush b = new SolidColorBrush();
b.Color = Colors.Orange;
SimpleLineSymbol ls = new SimpleLineSymbol();
ls.Color = b;
ls.Width = 2;
ViewerMeasureAction m = new ViewerMeasureAction()
{
LineSymbol = ls,
MeasureMode = MeasureAction.Mode.Polyline,
DisplayTotals = true,
DistanceUnit = DistanceUnit.Feet,
};
m.Attach(MapApplication.Current.Map);
m.Execute();
}
public bool CanExecute(object parameter)
{
// Return true so that the command can always be executed
return true;
}
public event EventHandler CanExecuteChanged;
#endregion
}
***Wrapper class for the Silverlight measure tool*** public class ViewerMeasureAction : MeasureAction
{
public void Execute()
{
Invoke(null);
}
}