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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:35:40+00:00 2026-05-20T00:35:40+00:00

I have a map with a MapItemsControl in my WP7 app that contains pushpins

  • 0

I have a map with a MapItemsControl in my WP7 app that contains pushpins bound to items in a collection of custom classes. The pushpins are bound to properties of the item in the collection via a DataTemplate.

When an item is added to or removed from the collection, all pins display correctly, with properties as per bindings, but when just an items’ properties are modified, the UI does not update. The bindings just seem to get values from the source item upon loading, but I’d like them to keep the UI elements updated when the source collection items’ properties are updated.

To illustrate, I’ll create a similar example:

Here’s a custom class:

Public Class Box
    Property CurrentColor As Color
    Property Location As GeoCoordinate
End Class

There’s a collection of them:

Dim TempBoxes As ObservableCollection(Of Box)

My map control has a MapItemsControl in it:

<maps:MapItemsControl Name="BoxControl"
    ItemTemplate="{StaticResource BoxTemplate}"
    ItemsSource="{Binding TempBoxes}"/>

The item template is something like this:

<DataTemplate x:Key="BoxTemplate">
    <maps:Pushpin Location="{Binding Location}" ManipulationStarted="BoxTouched">
        <maps:Pushpin.Template>
            <ControlTemplate>
                <Ellipse Width="35" Height="35" Margin="54,148,366,584"
                    Stretch="Fill" StrokeThickness="4" Stroke="Black"
                    Fill="{Binding CurrentColor}" />
            </ControlTemplate>
        </maps:Pushpin.Template>
    </maps:Pushpin>
</DataTemplate>

The touch event handler switches the pin’s color between blue and red:

Private Sub BoxTouched(ByVal sender As Object, ByVal e As RoutedEventArgs)
    With DirectCast(DirectCast(sender, Pushpin).DataContext, Box)
        If .CurrentColor = Colors.Red Then
            .CurrentColor = Colors.Blue
        Else
            .CurrentColor = Colors.Red
        End If
    End With
End Sub

Whenever I add or remove items from TempBoxes, the pins all render as they should (e.g. if I specify a color in the collection item, the pin shows the color).

Tapping on the item triggers the BoxTouched sub, which causes the item’s color to change in the collection, but the UI doesn’t change (pin color stays the same).

To get the UI to update the color, I have to get it to render the pins again, by adding something like this to BoxTouched:

BoxControl.ItemsSource = Nothing
BoxControl.ItemsSource = TempBoxes

I’m assuming there’s a better way to do this?

  • 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-20T00:35:41+00:00Added an answer on May 20, 2026 at 12:35 am

    In order for the DataTemplate to respond to changes in property values for your data object you need to implement the INotifyPropertyChanged interface on your data object so that property change notification is raised when your properties change.

    Take a look at the VB samples in the MSDN documentation if you’re unsure how to do this.

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

Sidebar

Related Questions

I am porting an iPhone app to WP7 which contains a map with several
I have an issue with a collection that I have bound. I have a
I have a map that i want to update from a separate thread. Im
I have image map that can I move, but this map will be so
for example we have map map<char,int>mymap; mymap['a']=101; mymap['c']=45; mymap['b']=76; mymap['d']=98; i know that if
Let's say I have the simple rails blog app. And I have a custom
In my Map application I have segment controller on main screen and using that
I have map of item names and vectors of vectors which store categories which
In routes.rb I have map.resources :groups, :collection => { :find_or_create => :get, :search =>
I have map application in which I have a button. On clicking that button

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.