Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I think this is an easy question - but it's stumped me!

I have a dependency property called 'Location' in a control that wraps google maps. When the map is clicked, I set the property, this works fine. However, when something else sets the property, I need to update the position on the map - how can I know the 'direction' of a dependency property? For example:
OnLocationChanged(DependencyObject o, DependencyPropertyChangedEventArgs args)
{
// if its been set by the click, the map's up to date

// if its been set otherwise, update the map
UpdateMapPosition(args.NewValue);
}


Thanks in advance!!
Posted
Comments
Sergey Alexandrovich Kryukov 8-Jul-11 6:49am    
Not clear -- just yet. What do you mean by "direction", more exactly. Please, an example of two or more different "directions".
--SA
Pete O'Hanlon 8-Jul-11 6:53am    
He's talking about the direction used to update the property (in other words, whether the property was updated from the map or from some other location, which would require the map being updated).
Pete O'Hanlon 8-Jul-11 6:54am    
Could you please supply the full DP definition otherwise I'm just trying to guess what you've got here?

1 solution

Wouldn't it be just the case that anytime the Location is changed, you would update the map?

Then inside the update, you'd just check to see if its already been set to the correct location. If so, bail out. If not, update the map.

All you are trying to do here is keep the two in sync.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900