forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ListView grouping issue on UWP ListView (xamarin#14653)
- Loading branch information
1 parent
e62b6ae
commit a717324
Showing
4 changed files
with
107 additions
and
18 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue14095.xaml
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,28 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<local:TestContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Title="Test 14095" xmlns:local="using:Xamarin.Forms.Controls" | ||
x:Class="Xamarin.Forms.Controls.Issues.Issue14095"> | ||
<StackLayout | ||
Padding="12"> | ||
<Label | ||
Text="If group headers are correct, the test has passed."/> | ||
<ListView | ||
x:Name ="lstView" | ||
IsGroupingEnabled="true" | ||
GroupDisplayBinding="{Binding LongName}" | ||
GroupShortNameBinding="{Binding ShortName}"> | ||
<ListView.ItemTemplate> | ||
<DataTemplate> | ||
<TextCell | ||
Text="{Binding Name}" | ||
Detail = "{Binding Comment}" /> | ||
</DataTemplate> | ||
</ListView.ItemTemplate> | ||
</ListView> | ||
</StackLayout> | ||
</local:TestContentPage> |
65 changes: 65 additions & 0 deletions
65
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue14095.xaml.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,65 @@ | ||
ο»Ώusing Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
using System.Collections.ObjectModel; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.ListView)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 14095, | ||
"[Bug] ListView grouping group names not shown on UWP", | ||
PlatformAffected.UWP)] | ||
public partial class Issue14095 : TestContentPage | ||
{ | ||
ObservableCollection<GroupedIssue14095Model> Grouped { get; set; } | ||
|
||
public Issue14095() | ||
{ | ||
#if APP | ||
InitializeComponent(); | ||
|
||
Grouped = new ObservableCollection<GroupedIssue14095Model> (); | ||
var veggieGroup = new GroupedIssue14095Model () { LongName = "vegetables", ShortName="v" }; | ||
var fruitGroup = new GroupedIssue14095Model () { LongName = "fruit", ShortName = "f" }; | ||
veggieGroup.Add (new Issue14095Model () { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" }); | ||
veggieGroup.Add (new Issue14095Model () { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" }); | ||
veggieGroup.Add (new Issue14095Model () { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" }); | ||
veggieGroup.Add (new Issue14095Model () { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" }); | ||
fruitGroup.Add (new Issue14095Model () {Name = "banana", IsReallyAVeggie = false,Comment = "available in chip form factor"}); | ||
fruitGroup.Add (new Issue14095Model () {Name = "strawberry", IsReallyAVeggie = false,Comment = "spring plant"}); | ||
fruitGroup.Add (new Issue14095Model () {Name = "cherry", IsReallyAVeggie = false,Comment = "topper for icecream"}); | ||
|
||
Grouped.Add (veggieGroup); | ||
Grouped.Add (fruitGroup); | ||
|
||
lstView.ItemsSource = Grouped; | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
} | ||
} | ||
|
||
public class Issue14095Model | ||
{ | ||
public string Name { get; set; } | ||
public string Comment { get; set; } | ||
public bool IsReallyAVeggie { get; set; } | ||
public string Image { get; set; } | ||
} | ||
|
||
public class GroupedIssue14095Model : ObservableCollection<Issue14095Model> | ||
{ | ||
public string LongName { get; set; } | ||
public string ShortName { get; set; } | ||
} | ||
} |
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