Hi,
I try to achive the following: I want to display tours on a map. A tour consists of multiple stations which are locations. I do not want to draw a concrete route, but some kind of a sketch route. That means that all the stations are connected with straight lines. So far, this is no problem, I can use the MapPolyline for this. I want the stations itself to be displayed as filled circles. I want to be able to visualize multiple tours in the same map. (See attached picture)
I am working with MVVM apporoach, so I want to have a single Control, lets call it MapTour which I can use like that:
In the ViewModel I have a property Tours as an ObservableCollection<TourViewModel>. TourViewModel is defined as follows:
But I can not figure out how to write the MapRoute control. I know that I can add two InformationLayers for one rout, one for the polyline and the other for the points. But how can I encapsulate this into a control? What base class do I have to use? I can not nest InformationLayers, if I could I would derive from this class and add my visuals in code. But nesting Information layers does not seem to work.
What do I have to fill in for the data template to achive the described behaviour?
Thanks for your help.
Tobias.
I try to achive the following: I want to display tours on a map. A tour consists of multiple stations which are locations. I do not want to draw a concrete route, but some kind of a sketch route. That means that all the stations are connected with straight lines. So far, this is no problem, I can use the MapPolyline for this. I want the stations itself to be displayed as filled circles. I want to be able to visualize multiple tours in the same map. (See attached picture)
I am working with MVVM apporoach, so I want to have a single Control, lets call it MapTour which I can use like that:
<
telerik:RadMap
x:Name
=
"radMap"
<telerik:InformationLayer
x:Name
=
"TourLayer"
ItemsSource
=
"{Binding Tours}"
>
<
telerik:InformationLayer.ItemTemplate
>
<
DataTemplate
>
<
my:MapTour
Stations
=
"{Binding Stations}"
/>
</
DataTemplate
>
</
telerik:InformationLayer.ItemTemplate
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
In the ViewModel I have a property Tours as an ObservableCollection<TourViewModel>. TourViewModel is defined as follows:
public class TourViewModel : INotifyPropertyChanged
{
private String m_TourName;
private ObservableCollection<
LISCoordinate
> m_Stations;
public ourViewModel()
{
TourName = "Empty";
Stations = new ObservableCollection<
Location
>();
}
public String TourName
{
get { return m_TourName; }
set { m_TourName = value; OnPropertyChanged("TourName"); }
}
public ObservableCollection<
Location
> Stations
{
get { return m_Stations; }
set { m_Stations = value; OnPropertyChanged("Stations"); }
}
// INotifyPropertyChanged implementation omitted.
}
But I can not figure out how to write the MapRoute control. I know that I can add two InformationLayers for one rout, one for the polyline and the other for the points. But how can I encapsulate this into a control? What base class do I have to use? I can not nest InformationLayers, if I could I would derive from this class and add my visuals in code. But nesting Information layers does not seem to work.
What do I have to fill in for the data template to achive the described behaviour?
Thanks for your help.
Tobias.