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

Projects
None yet
8 participants
@samhouts
Member

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 ?

@StephaneDelcroix

StephaneDelcroix Dec 13, 2016

Member

do you still have something to do here ?

This comment has been minimized.

@samhouts

samhouts Jan 4, 2017

Member

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

@samhouts

samhouts Jan 4, 2017

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 ?

@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

Member

Probably; just using the same convention as iOS.

@samhouts

samhouts Jan 4, 2017

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, ... ?

@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

Member

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

@samhouts

samhouts Jan 4, 2017

Member

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

@samhouts samhouts requested a review from jassmith Jan 5, 2017

@TomQv

This comment has been minimized.

Show comment
Hide comment
@TomQv

TomQv Feb 21, 2017

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

TomQv commented Feb 21, 2017

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

samhouts added some commits Dec 12, 2016

@samhouts samhouts removed the request for review from jassmith Feb 21, 2017

@samhouts samhouts requested a review from hartez Feb 21, 2017

@escamoteur

This comment has been minimized.

Show comment
Hide comment
@escamoteur

escamoteur Feb 28, 2017

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

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?

@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

Member

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

@samhouts

samhouts Mar 1, 2017

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?

@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

Member

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

@samhouts

samhouts Mar 1, 2017

Member

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

@samhouts

This comment has been minimized.

Show comment
Hide comment
@samhouts

samhouts Mar 1, 2017

Member

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

Member

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

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

[Win] Labels will now wrap when inside horizontally infinite layouts (#…
…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 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