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 8916331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:13:08+00:00 2026-06-15T05:13:08+00:00

I have following XAML code : <maps:Map Name=PlaygroundMap Credentials=YOUR_BING_MAPS_KEY> <maps:MapItemsControl x:Name=PlaygroundMapItems my:MapExt.ClusteredItemsSource={Binding Locations} ItemTemplate={StaticResource

  • 0

I have following XAML code :

<maps:Map Name="PlaygroundMap" Credentials="YOUR_BING_MAPS_KEY">
   <maps:MapItemsControl  
           x:Name="PlaygroundMapItems"
           my:MapExt.ClusteredItemsSource="{Binding Locations}" 
           ItemTemplate="{StaticResource PinTemplate}"/>
 </maps:Map>  

Also ClusteredItemsSource is my own attached property with the following code (only important part is shown) :

private static void OnItemsReceived(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var mapItemsControl = d as MapItemsControl;

            if(mapItemsControl == null) return;

            var map = VisualTreeHelper.GetParent(mapItemsControl); // this is always NULL
            var map2 = mapItemsControl.Parent; // this is always NULL

            var items = e.NewValue as IEnumerable<Location>;
             mapItemsControl.ItemsSource = items;
        }

So my requirement is to have MAP reference in OnItemsReceived method. I thought that this will be easy because if you check XAML again you will see that mapItemsControl is child of Map (or map is parent of mapItemsControl).

But somehow variable map & map2 are always NULL. Is this normal behaviour or?

Also, if this “parent” approach will not work, can you suggest me what are my other options to get Map reference in MapItemsControl (to be exact, to get map reference in my custom attached property).

Btw, I’m using Bing Maps SDK for WinRT.

  • 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-06-15T05:13:09+00:00Added an answer on June 15, 2026 at 5:13 am

    VisualTreeHelper won’t help you if your controls are not part of the visual tree – either because they were not added to one yet (Loaded event wasn’t raised yet) or maybe they don’t use the standard parent/child control relationship triggers (by one being logically a child of a Panel, ContentControl etc.)

    The best approach here really is to forget about the visual tree and use bindings and view models instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following xaml-Code: <Border x:Name=border> <Border.Style> <Style TargetType={x:Type Border}> <Style.Triggers> <DataTrigger Binding={Binding
I have a following XAML: <ComboBox Name=groupComboBox ItemsSource={Binding Path=MyServiceMap.Groups} DisplayMemberPath={Binding Name}/> In the code
I have the following XAML code: <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible=True IsMenuEnabled=False x:Name=PageBar> <shell:ApplicationBarIconButton IconUri=/Assets/Icons/appbar.questionmark.rest.png Text=Help
I have the following XAML Code: <sdk:DataGrid Margin=58,8,52,18 Name=dataGridTickets> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn x:Name=ticketNoColumn Header=Ticket No.
I have created two buttons using the following XAML code. <Button x:Name=Button1 Width=100 Content=Button1
I have the following XAML: <ListBox HorizontalAlignment=Left Margin=0,6,0,10 Name=listBox1 Width=468 ItemsSource={Binding} Grid.ColumnSpan=1> <ItemsControl.ItemTemplate> <DataTemplate>
I have a following XAML: <DataGrid Name=nodeDataGrid ItemsSource={Binding NodeList} AutoGenerateColumns=False RowBackground=White AlternatingRowBackground=AliceBlue Grid.Column=1 HorizontalAlignment=Stretch
I have the following XAML code: <ListBox ItemsSource={Binding Languages}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Image Source={Binding
I'm developing a Windows Phone app. I have the following XAML code: <Grid x:Name=ContentPanel
I have the following column defined in my xaml code <telerik:GridViewMaskedTextBoxColumn Mask=P1 MaskType=Numeric DataMemberBinding={Binding

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.