Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6983451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:25:14+00:00 2026-05-27T18:25:14+00:00

This is my control with my custom DataTemplateSelector: <m:Map x:Name=MainMap> <m:MapItemsControl ItemsSource={Binding Source={StaticResource WorkLayerData}}>

  • 0

This is my control with my custom DataTemplateSelector:

<m:Map x:Name="MainMap">
            <m:MapItemsControl 
                ItemsSource="{Binding Source={StaticResource WorkLayerData}}">
                <m:MapItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Mobile:DevicePushpinTemplateSelector 
                            m:MapLayer.Position="{Binding Location}" 
                            ZoomLevel="{Binding ZoomLevel, ElementName=MainMap}" 
                            Content="{Binding}">
                            <Mobile:DevicePushpinTemplateSelector.DotTemplate>
                                <DataTemplate>
                                    <Ellipse Width="8" Height="8" Stroke="Black" Fill="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" StrokeThickness="1" /> 
                                </DataTemplate>
                            </Mobile:DevicePushpinTemplateSelector.DotTemplate>
                            <Mobile:DevicePushpinTemplateSelector.NumberedTemplate>
                                <DataTemplate>
                                    <Border x:Name="border" Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="2" Padding="2" Height="20" CornerRadius="8">
                                        <TextBlock  VerticalAlignment="Center" Text="{Binding DisplayId}" />
                                    </Border>                                  
                                </DataTemplate>
                            </Mobile:DevicePushpinTemplateSelector.NumberedTemplate>
                            <Mobile:DevicePushpinTemplateSelector.DetailedTemplate>
                                <DataTemplate>  

                                    <Border Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="1" Padding="2" CornerRadius="2">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                                <RowDefinition Height="Auto" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock  Text="Id:" FontWeight="Bold" />
                                            <TextBlock  Text="{Binding DisplayId}" Grid.Column="1" />
                                            <TextBlock  Text="Device Id:" FontWeight="Bold" Grid.Row="1" />
                                            <TextBlock  Text="{Binding DeviceId}" Grid.Row="1" Grid.Column="1" />
                                            <TextBlock  Text="Speed:" FontWeight="Bold" Grid.Row="2" />
                                            <TextBlock  Text="{Binding Speed}" Grid.Row="2" Grid.Column="1" />
                                            <TextBlock  Text="Location:" FontWeight="Bold" Grid.Row="3" />
                                            <TextBlock  Text="{Binding Location}" Grid.Row="3" Grid.Column="1" />
                                            <Button Content="View Details" Grid.Row="4" Grid.ColumnSpan="2" />
                                        </Grid>                                        
                                    </Border>
                                </DataTemplate>
                            </Mobile:DevicePushpinTemplateSelector.DetailedTemplate>
                        </Mobile:DevicePushpinTemplateSelector>
                    </DataTemplate>
                </m:MapItemsControl.ItemTemplate>
            </m:MapItemsControl>
        </m:Map>

I want to move my Mobile:DevicePushpinTemplateSelector.DetailedTemplate into resources so I can reuse it somewhere else.

I declared resource:

<UserControl.Resources>
        <DataTemplate x:Key="DetailedMapItemTemplate">
            <Border Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="1" Padding="2" CornerRadius="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock  Text="Id:" FontWeight="Bold" />
                    <TextBlock  Text="{Binding DisplayId}" Grid.Column="1" />
                    <TextBlock  Text="Device Id:" FontWeight="Bold" Grid.Row="1" />
                    <TextBlock  Text="{Binding DeviceId}" Grid.Row="1" Grid.Column="1" />
                    <TextBlock  Text="Speed:" FontWeight="Bold" Grid.Row="2" />
                    <TextBlock  Text="{Binding Speed}" Grid.Row="2" Grid.Column="1" />
                    <TextBlock  Text="Location:" FontWeight="Bold" Grid.Row="3" />
                    <TextBlock  Text="{Binding Location}" Grid.Row="3" Grid.Column="1" />
                    <Button Content="View Details" Grid.Row="4" Grid.ColumnSpan="2" />
                </Grid>
            </Border>
        </DataTemplate>
    </UserControl.Resources>

My problem is that I don’t know HOW to use this DataTemplate inside my selector. What is the XAML I need to use? With controls like ListBox it is easy, just set ItemTemplate="{StaticResource thisTemplate}" but how do I do this in my case? Still learning XAML

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:25:14+00:00Added an answer on May 27, 2026 at 6:25 pm

    Just set the DetailedTemplate property in the tag itself:

    <Mobile:DevicePushpinTemplateSelector
              m:MapLayer.Position="{Binding Location}" 
              ZoomLevel="{Binding ZoomLevel, ElementName=MainMap}" 
              Content="{Binding}"
              DetailedTemplate="{StaticResource DetailedMapItemTemplate}">
              ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing a custom control and in this control I need to write a
I have a custom control that inherits from .NET's CompositeControl class. This control overrides
I am creating a custom control. I want the template for this control to
I have a custom user control on my windows forms. This control has a
I create a custom control inherited from Windows.System.Forms.Controls. This is my code of this
For example, I have a custom control called SampleControl. To simplify things for this
I'm dynamically adding a custom user control to the page as per this post
I'm writing a custom compound control that extends RelativeLayout. Inside this component, there is
I'm trying to implement the Media Player custom field control described in this MSDN
I'd like to add custom controls to the mediaPlayer control view much as this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.