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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:11:14+00:00 2026-06-11T13:11:14+00:00

I have a simple handler that adds an ellipse to an empty Silverlight canvas

  • 0

I have a simple handler that adds an ellipse to an empty Silverlight canvas

    private void UCLoaded(object sender, RoutedEventArgs e)
    {
        var geometry = MakeElipse(20, 15, new Point(100, 100));
        var ellipsePath = new Path
        {
            Data = geometry,
            Fill = new SolidColorBrush(Colors.DarkGray),
            StrokeThickness = 4,
            Stroke = new SolidColorBrush(Colors.Gray)
        };
        LayoutRoot.Children.Add(ellipsePath);
        //
        var duplicateEllipsePath = new Path();
        //duplicateEllipsePath.Data = ellipsePath.Data; 
        duplicateEllipsePath.Data = geometry;
        duplicateEllipsePath.Fill = ellipsePath.Fill; 
        duplicateEllipsePath.StrokeThickness = ellipsePath.StrokeThickness;
        duplicateEllipsePath.Stroke = ellipsePath.Stroke;
        LayoutRoot.Children.Add(duplicateEllipsePath);
    }

The first ellipse, ellipsePath, is fine and renders as expected. But the line duplicateEllipsePath.Data = ellipsePath.Data or the alternative duplicateEllipsePath.Data = geometry each throw the System.ArgumentException “Value does not fall within the expected range”. How can it be in range once, and out-of-range immediately afterwards? What is the correct way of duplicating a path in code like 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-06-11T13:11:15+00:00Added an answer on June 11, 2026 at 1:11 pm

    It looks like the only way to clone a path is to do so manually. To quote this answer from Yi-Lun Luo:

    The Data property is actually a Geometry. While not noticeable in Silverlight, A Geometry actually relies on an underlying system resource (because it needs to draw something). If you need to draw another Geometry, you’ll need another system resource. So you must clone it before you assign it to a new Path. In WPF, we do have a Clone method on Geometry, unfortunately this is not supported in Silverlight. So you have to manually do the clone.

    Another post above Yi-Lun’s claims to contain reflective code to clone a geometry, and the same code seems to appear here, although the latter is more clearly formatted. However, in your case, it seems overkill to use a method such as this. The geometry you use is created by your MakeElipse [sic] method. Extracting the common code to generate the geometries into a method seems about the best way to proceed here.

    The error message ‘Value does not fall within the expected range’ is a bit misleading. I don’t see anything ‘out of range’, given that the exact same object was supposedly in range for your first ellipse. I can’t say exactly why this error message is reported, but I can speculate. Silverlight is implemented in native code, and I believe that because the native code can’t throw exceptions it instead returns numeric error codes. Perhaps there’s a limited number of error codes and the one for ‘Value does not fall within the expected range’ was the one chosen for this error?

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

Sidebar

Related Questions

I have a simple Python script that uses a signal handler for Ctl-C. If
I have a handler that returns json public void ProcessRequest (HttpContext context) { HttpResponse
I have a simple click handler that will alert its link's href as in:
I have a simple event handler with a ItemAdding event that changes a column
I have a simple WPF application that uses ClickOnce to handle installing. Within this
I have simple SSIS package in which On Error event handler I have created
I have simple php validation form that is halfway working. If you leave the
I have the following simple handler (removed some code for vissibilty sakes, but the
I have a simple find in rails 3 that gathers users accounts. Account.where(:user_id =>
I am building a Space Invaders game. I have got a simple algorithm that

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.