I got the Silverlight Map Control and I want to access the BoundingRectangle Property. But it's not a dependencyproperty. So my tought was to create an attaches Property which is bound to a property in my ViewModel. And everytime this Property is called the DepdendencyProperty Getter should return the BoundingRectangle Property of the Map Element. But sadly the Getter isn't called...
Heres my Code
public class MapHelper
{
public static readonly DependencyProperty MapViewRectangleProperty =
DependencyProperty.RegisterAttached(
"MapViewRectangle",
typeof(LocationRect),
typeof(MapHelper),
new PropertyMetadata(null, new PropertyChangedCallback(MapViewRectanglePropertyChanged))
);
private static void MapViewRectanglePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
string balls = "balls";
}
public static void SetMapViewRectangle(object element, LocationRect value)
{
string balls = "balls";
}
public static LocationRect GetMapViewRectangle(object element)
{
if (element is Map)
{
return (LocationRect)(((Map)element).TargetBoundingRectangle);
}
else
{
return null;
}
}
}
XAML:
<m:Map utils:MapHelper.MapViewRectangle="{Binding Path=BoundingRectangle}" />
ViewModel:
public LocationRect BoundingRectangle
{
get;
set;
}
I hope you can help me :)