dotnet / dotnet/wpf

A WPF rectangle will render with zero size when Stretch = None

Open
#644 4 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

I just ran into this problem and also found an existing post on SO asking about the same issue.

Summary:

The Rectangle's Stretch property when setting it to NONE ... According to MSDN, the definition for this value is "The content preserves its original size." Look at the code below. When I set Stretch = NONE on the rectangle, it disappears.

Someone looked at the Rectangle ArrangeOverride method which has this key section:

<code>caseStretch.None:         

{ this._rect.Width=(this._rect.Height=0.0); break; }

(sorry for the bad formatting, I can't get it to paste neatly)

So it seems that when Stretch is None there is only empty rectangle. This doesn't seem to make sense.

The SO post I mentioned is: https://stackoverflow.com/questions/5822662/rectangle-stretch-property-behavior

_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/538676/a-wpf-rectangle-will-render-with-zero-size-when-st.html
VSTS ticketId: 850101_
_These are the original issue comments:_

Visual Studio Feedback System on 4/18/2019, 08:33 PM (14 days ago):

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

_These are the original issue solutions:_
(no solutions)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.