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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:49:40+00:00 2026-05-26T23:49:40+00:00

Consider the following code: [Serializable] public class Region { public double North {get; set;}

  • 0

Consider the following code:

[Serializable]
public class Region
{
   public double North {get; set;}
   public double South {get; set;}
   public double East {get; set;}
   public double West {get; set;}

   public static Region Europe { get { return new BoundingBox() { North= 71, South= 36, East= 42, West= -9 }; } }
   public static Region GulfMexico { get { return new BoundingBox() { North = 30, South = 18, East = -97, West = -80 }; } }
   public static Region Australia { get { return new BoundingBox() { North = -11, South = -40, East = 154, West = 114 }; } }
   public static Region ...
}

public class MyClass
{
    public Region SelectedRegion { get; set; }
}

I would like to create an instance of MyClass in XAML and set its SelectedRegion property both of the following ways just like we can do with Brush-es when setting Grid.Background:

First:

   <MyClass>
        <MyClass.SelectedRegion>
            <Region North ="5" South = "6" East = "7" West = "8"/>
        </MyClass.SelectedRegion>
    </MyClass>

Second:

<MyClass SelectedRegion = "Australia"/>

The first way of setting SelectedRegion works, of course. What is it I need to add to my code to facilitate the second way?

  • 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-05-26T23:49:40+00:00Added an answer on May 26, 2026 at 11:49 pm

    You need to create a TypeConverter that will convert a string (“Australia”) to an instance of the Region type. See the following link for details on how to do it: http://msdn.microsoft.com/en-us/library/aa970913.aspx.

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

Sidebar

Related Questions

Consider the following code: [Serializable] public class Human { public string Name { get;
Consider the following code: @Entity @Table(name = a) public class A implements Serializable {
consider the following class and struct public class Entity { public IdType Id {get;set;}
Consider the following code: public abstract class RepositoryBase<T> where T : class { #region
Consider following code public class City { public string Name { get { return
Consider the following code, public class StartUp { public StartUp(String[] test){} public static void
Consider the following code: public abstract class Test1 { public object Data { get;
Consider the following code in a DLL: public class ReceivingClass { private Assembly myAssembly;
Let's consider the following code: public class MyPanel extends JPanel { private long secretInfo
Consider the following code: class Test() { public: Test() { memset( buffer, 0, sizeof(

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.