This repository has been archived by the owner on May 1, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
3 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla42599.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
using System.Linq; | ||
using System; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Bugzilla, 42599, "LineBreakMode does not work on UWP", PlatformAffected.WinRT)] | ||
public class Bugzilla42599 : TestContentPage | ||
{ | ||
protected override void Init() | ||
{ | ||
var scrollView = new ScrollView(); | ||
var layout = new StackLayout(); | ||
|
||
foreach (var lineBreakMode in Enum.GetValues(typeof(LineBreakMode)).Cast<LineBreakMode>()) | ||
{ | ||
layout.Children.Add(GetLayout(lineBreakMode)); | ||
} | ||
scrollView.Content = layout; | ||
Content = scrollView; | ||
} | ||
|
||
static StackLayout GetLayout(LineBreakMode lineBreakMode) | ||
{ | ||
var text = ""; | ||
|
||
switch (lineBreakMode) | ||
{ | ||
default: | ||
case LineBreakMode.NoWrap: | ||
text = "This is a long sentence that should NOT wrap. If this sentence has wrapped, then this test has failed."; | ||
break; | ||
case LineBreakMode.WordWrap: | ||
text = "This is a long sentence that should word wrap. If this sentence has NOT wrapped, then this test has failed."; | ||
break; | ||
case LineBreakMode.CharacterWrap: | ||
text = "This is a long sentence that should character wrap. If this sentence has NOT wrapped, then this test has failed."; | ||
break; | ||
case LineBreakMode.HeadTruncation: | ||
text = "This is a long sentence that should truncate at the beginning. If this sentence has NOT truncated, then this test has failed."; | ||
break; | ||
case LineBreakMode.TailTruncation: | ||
text = "This is a long sentence that should truncate at the end. If this sentence has NOT truncated, then this test has failed."; | ||
break; | ||
case LineBreakMode.MiddleTruncation: | ||
text = "This is a long sentence that should truncate at the middle. If this sentence has NOT truncated, then this test has failed."; | ||
break; | ||
} | ||
|
||
var label = new Label | ||
{ | ||
LineBreakMode = lineBreakMode, | ||
Text = text, | ||
}; | ||
|
||
var layout = new StackLayout | ||
{ | ||
Children = { label }, | ||
Orientation = StackOrientation.Horizontal | ||
}; | ||
|
||
return layout; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters