Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Win] Labels will now wrap when inside horizontally infinite layouts #639

Merged
merged 3 commits into from Mar 14, 2017

Conversation

@samhouts
Copy link
Member

@samhouts samhouts commented Dec 12, 2016

Description of Change

Ported GetDesiredSize override from iOS to WinRT/UWP LabelRenderer.

Bugs Fixed

API Changes

None

Behavioral Changes

None

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense
@@ -164,6 +191,7 @@ void UpdateLineBreakMode(TextBlock textBlock)
textBlock.TextWrapping = TextWrapping.Wrap;
break;
case LineBreakMode.HeadTruncation:
// TODO: This truncates at the end.

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Dec 13, 2016
Member

do you still have something to do here ?

This comment has been minimized.

@samhouts

samhouts Jan 4, 2017
Author Member

No, just an existing quirk that I wanted to note.

@@ -35,6 +35,8 @@ public class LabelRenderer : ViewRenderer<Label, TextBlock>
{
bool _fontApplied;
bool _isInitiallyDefault;
SizeRequest _perfectSize;
bool _perfectSizeValid;

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Dec 13, 2016
Member

can't you use a single nullable variable for both ?

This comment has been minimized.

@samhouts

samhouts Jan 4, 2017
Author Member

Probably; just using the same convention as iOS.

@@ -146,6 +171,8 @@ void UpdateFont(TextBlock textBlock)

void UpdateLineBreakMode(TextBlock textBlock)
{
_perfectSizeValid = false;

This comment has been minimized.

@StephaneDelcroix

StephaneDelcroix Dec 13, 2016
Member

don't you have to invalidate perfect size on text change, font change, ... ?

This comment has been minimized.

@samhouts

samhouts Jan 4, 2017
Author Member

I do invalidate on text change, but I think I missed font change.

@samhouts samhouts force-pushed the fix-bugzilla42559 branch from b877e53 to df2dbef Jan 4, 2017
@samhouts samhouts requested a review from jassmith Jan 5, 2017
@TomQv
Copy link

@TomQv TomQv commented Feb 21, 2017

When will this be merged?
Its desperatly awaited...

samhouts added 3 commits Dec 12, 2016
@samhouts samhouts force-pushed the fix-bugzilla42559 branch from df2dbef to 74f638c Feb 21, 2017
@samhouts samhouts removed the request for review from jassmith Feb 21, 2017
@samhouts samhouts requested a review from hartez Feb 21, 2017
@escamoteur
Copy link

@escamoteur escamoteur commented Feb 28, 2017

Will this also address iOS? I have a similar behaviour with a Label inside a Grid

if (!_perfectSizeValid)
{
_perfectSize = base.GetDesiredSize(double.PositiveInfinity, double.PositiveInfinity);
_perfectSize.Minimum = new Size(Math.Min(10, _perfectSize.Request.Width), _perfectSize.Request.Height);

This comment has been minimized.

@hartez

hartez Feb 28, 2017
Member

Where do the 10 values used for minimum width come from?

This comment has been minimized.

@samhouts

samhouts Mar 1, 2017
Author Member

Hmm, it's a straight copy from the iOS version. Not sure.

@@ -172,6 +204,7 @@ void UpdateLineBreakMode(TextBlock textBlock)
textBlock.TextWrapping = TextWrapping.NoWrap;
break;
case LineBreakMode.MiddleTruncation:
// TODO: This truncates at the end.

This comment has been minimized.

@hartez

hartez Feb 28, 2017
Member

Can we add some more detail on this TODO? Is the noted behavior something we can fix, or is it just that WinRT doesn't natively support this type of truncation?

This comment has been minimized.

@samhouts

samhouts Mar 1, 2017
Author Member

It looks like it's not natively supported. Wanted to do some investigation. Will add to the comment.

@samhouts
Copy link
Member Author

@samhouts samhouts commented Mar 1, 2017

@escamoteur You may find that #529 fixes your issue on iOS. If not, please let us know on Bugzilla. Thanks!!

@rmarinho rmarinho merged commit 05f0f76 into master Mar 14, 2017
6 checks passed
6 checks passed
Android-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run Android 6.0.1 : Tests passed: 353, i…
Details
OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3743, ignored: 10
Details
iOS10-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS10 : Tests passed: 35…
Details
iOS8-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified IOS8 : Tests passed: 351…
Details
iOS9-UITests-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: UI Tests :: OSX Test Cloud Package - Run iOS Unified iOS9 : Tests passed: 353…
Details
rmarinho added a commit that referenced this pull request Mar 22, 2017
…639)

* Add repro for 42559

* [Win] Override GetDesiredSize for LabelRenderer

* [Win] Invalidate size on font/align change
@samhouts samhouts deleted the fix-bugzilla42559 branch Apr 19, 2017
@samhouts samhouts added D15.4 and removed cla-not-required labels Oct 10, 2017
@samhouts samhouts modified the milestone: 3.1.0 Jun 1, 2018
@samhouts samhouts added this to the 2.3.0 milestone Jun 27, 2018
@samhouts samhouts modified the milestones: 2.3.0, 2.3.4 Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.