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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:43:08+00:00 2026-06-15T04:43:08+00:00

Rectangle rectangle = new Rectangle(); rectangle.StrokeThickness = 10; rectangle.Height = 200; rectangle.Width = 100;

  • 0
Rectangle rectangle = new Rectangle();
rectangle.StrokeThickness = 10;
rectangle.Height = 200;
rectangle.Width = 100;

//Self defined propety
Boolean AutoSize = false;
rectangle.DataContext = AutoSize;

//Add binding
Binding bind = new Binding(rectangle.DataContext);
bind.Mode = BindingMode.OneWay;
bind.Converter = ConvertAutoSize2Height;
bindingList.Add(bind);

canvas.Children.Insert(0, rectangle);

//Value converter
[ValueConversion(typeof(Boolean), typeof(Double))]
public class ConvertAutoSize2Height : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        Boolean autoSize = (Boolean)value;
        if (autoSize)
            return Double.NaN;
        else
            return **<<<I wanna return original height if autosize is false>>>**;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

Please check the converter, I wanna return the rect’s original height if autosize is false.

  • 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-15T04:43:10+00:00Added an answer on June 15, 2026 at 4:43 am

    This seems to be a preferred solution, so I’m posting my comment as an answer.

    You may be able to achieve this using multibinding and IMultiValueConverter. You could then bind both autosize and the original height value and process it in the converter.

    Take a look at this link for more information about multibinding: http://blog.csainty.com/2009/12/wpf-multibinding-and.html.

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

Sidebar

Related Questions

In XAML: <Rectangle Stroke=Aqua Opacity=0.7 StrokeThickness=10 Canvas.Left=24 Canvas.Top=22 Height=86 Width=102> <Rectangle.Fill> <ImageBrush ImageSource=C:\Users\xiaorui.dong\Pictures\profile.jpeg></ImageBrush> </Rectangle.Fill>
I have a rectangle which has known width and height.Now devide rectangle diagonally to
i have composite object Composite composite = new Composite(shell, SWT.NONE); composite.setBounds(new Rectangle(10,10,100,100); How do
ArrayList<Rectangle> list = new ArrayList<Rectangle>(); for (int i=0; i < 10; i++) { list.add(new
If I got Dim myRect As Rectangle = New Rectangle(0,0,100,100) Is it necessary or
var bmd:BitmapData = ImageSnapshot.captureBitmapData(someSprite); trace(bmd size +getSize(bmd)); var bounds:Rectangle = new Rectangle(0, 0, bmd.width,
I'm new with OpenGLES and I was trying to draw a rectangle with alpha
I have defined a rectangle drawable like this: <shape xmlns:android=http://schemas.android.com/apk/res/android android:shape=rectangle> <corners android:radius=4dip/> <solid
I have one rectangle. The width of the rectangle is deciding based on the
I was trying to draw a square rectangle = new google.maps.Rectangle(); var rectOptions =

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.