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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:31:19+00:00 2026-06-13T00:31:19+00:00

I got the Silverlight Map Control and I want to access the BoundingRectangle Property.

  • 0

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 🙂

  • 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-13T00:31:20+00:00Added an answer on June 13, 2026 at 12:31 am

    Ok, another time I anwer to myself 😀

    Bound my Attached Property to my Property in ViewModel

    utils:MapHelper.MapViewRectangle="{Binding Path=BoundingRectangle,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
    

    Created a Behavior:

    public class MapBoundingRectangleBehavior : Behavior<Map>
    {
        protected override void OnAttached()
        {
            AssociatedObject.TargetViewChanged += new EventHandler<MapEventArgs>(AssociatedObject_TargetViewChanged);
        }
    
        void AssociatedObject_TargetViewChanged(object sender, MapEventArgs e)
        {
            AssociatedObject.SetValue(MapHelper.MapViewRectangleProperty, AssociatedObject.TargetBoundingRectangle);
        }
    }
    

    And added the Behavior to the Map Control:

    <i:Interaction.Behaviors>
                <behaviors:MapBoundingRectangleBehavior />
            </i:Interaction.Behaviors>
    

    Sounds so easy, but it’s the only solution that gave me always the corrent data for the BoundingRectangle!

    I hope I can help anybody who got the same Problem.

    Greetings
    Jonny

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

Sidebar

Related Questions

In silverlight, I got a textbox which I want to be multiline and have
I use Silverlight 4.0 and have got problems with ComboBox control. I want to
I've got a problem with the Silverlight default VS2008 project. Wnen I create a
I've got a Silverlight 4 custom control that basically is several Canvas elements wrapped
Apologies for cross posting (I asked this on the Silverlight Forum but got no
I've got a Silverlight class library which contains ResourceDictionary objects with styles that I
I recently submitted a small app working on Silverlight framework. But my app got
My scenario: I've got a Silverlight Application with a View, where i want to
Yesterday I got a question from a collegue about Silverlight's crossdomain access policy mechanism.
I've got a Silverlight app that I want to call from either https or

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.