0

In our project we have created a custom control with some dependency properties. On the xaml page where we are using this control we are binding the BoundingRectangle property of the Map control to this custom control so we can use these LocationRect object in our custom control.

When we are debugging this, we see that every property in the BoundingRectangle (North, NorthEast etc) all have the same location. If we are checking the properties on the map, than we see that these properties are not all the same. (as expected)

I have attached a change callback to the dependencyproperty, and also there I see all properties have the same value. However, if I bind the Center property than I see it update correctly.

We are binding the property on the custom control like this:

<CustomControls:MiniMap Name="SmallMap" BoundingBox="{Binding ElementName=Map, Path=BoundingRectangle}" />

And this is our dependency property:

 public static readonly DependencyProperty BoundingBoxProperty =
            DependencyProperty.Register("BoundingBox", typeof(Location), typeof(MiniMap), new UIPropertyMetadata(new LocationRect()));

Anyone knows why the BoundingBox property is not updated when the LocationRectangle is updated on the Map?

ChristiaanV
  • 5,401
  • 3
  • 32
  • 42
  • You did not explain what the problem is: I assume the problem is that when the BoundingRectangle property in the Map changes, the BoundingBox property in your custom control is not updated. Is that the problem? If yes: is the BoundingRectangle property in the Map a dependency property? In case it is not a dependency property: does the Map implement INotifyPropertyChanged? –  May 24 '12 at 15:32
  • You're right, I have updated the question. I'm using the built-in Microsoft Bing Maps control, is there a way to check if the BoundingRectangle property is a dependency property? – ChristiaanV May 24 '12 at 16:36
  • If the documentation mentions a field named `BoundingRectangleProperty`, then it is a dependency property. Otherwise, it is an ordinary property. –  May 24 '12 at 19:05

1 Answers1

0

Checked the documentation as fmunkert suggested and found out the BoundingBox on the Bing maps controls is not a dependency property.

We have created a custom map which implemented the ViewChanged event and updates our own dependency property, which we can now use to bind to our other control.

ChristiaanV
  • 5,401
  • 3
  • 32
  • 42