I have a ContentPresenter and I have assigned a DataTemplate
to its ContentTemplate
attribute. Now I want to add a MapIcon
in MapControl
which is child of DataTemplate as shown below:
<DataTemplate x:Key="EWDetailsContentTemplate" x:DataType="viewModels:Task">
<Grid x:Name="ContentPanel"
Background="White"
Margin="0,5,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Maps:MapControl x:Name="LocationMapControl"
MapServiceToken="key"
Grid.Row="0"
Height="250"/>
//more controls
</Grid>
How can I get MapControl using VisualTree concept of C#?