Skip to content

Commit 22dac5c

Browse files
michael-hawkerArlodotexe
authored andcommitted
Finish Fixing #513 - Cleans-up some of the duplicate usage of Person which was making for odd namespace collision (less confusing/mixed this way)
The last commit was similar to what was needed to fix #514
1 parent eea8a63 commit 22dac5c

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

components/Collections/samples/AdvancedCollectionViewSample.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
1818
</Style.Setters>
1919
</Style>
20-
<DataTemplate x:Key="PersonDataTemplate"
21-
x:DataType="local:Person">
20+
<DataTemplate x:Key="EmployeeDataTemplate"
21+
x:DataType="local:Employee">
2222
<TextBlock Text="{x:Bind Name}" />
2323
</DataTemplate>
2424
</Page.Resources>
@@ -52,7 +52,7 @@
5252
<Grid Grid.Row="2"
5353
Style="{StaticResource CardStyle}">
5454
<ListView x:Name="LeftList"
55-
ItemTemplate="{StaticResource PersonDataTemplate}"
55+
ItemTemplate="{StaticResource EmployeeDataTemplate}"
5656
ItemsSource="{x:Bind Original}" />
5757
</Grid>
5858
<TextBlock Grid.Row="1"
@@ -62,7 +62,7 @@
6262
Grid.Column="1"
6363
Style="{StaticResource CardStyle}">
6464
<ListView x:Name="RightList"
65-
ItemTemplate="{StaticResource PersonDataTemplate}"
65+
ItemTemplate="{StaticResource EmployeeDataTemplate}"
6666
ItemsSource="{x:Bind CollectionView}" />
6767
</Grid>
6868
</Grid>

components/Collections/samples/AdvancedCollectionViewSample.xaml.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace CollectionsExperiment.Samples;
1010
[ToolkitSample(id: nameof(AdvancedCollectionViewSample), "AdvancedCollectionView", description: $"A sample for showing how to create and use a {nameof(AdvancedCollectionView)} for sorting and filtering.")]
1111
public sealed partial class AdvancedCollectionViewSample : Page
1212
{
13-
public ObservableCollection<Person> Original { get; private set; }
13+
public ObservableCollection<Employee> Original { get; private set; }
1414

1515
public AdvancedCollectionView CollectionView { get; private set; }
1616

@@ -25,30 +25,30 @@ public AdvancedCollectionViewSample()
2525
private void Setup()
2626
{
2727
// left list
28-
Original = new ObservableCollection<Person>
28+
Original = new ObservableCollection<Employee>
2929
{
30-
new Person { Name = "Staff" },
31-
new Person { Name = "42" },
32-
new Person { Name = "Swan" },
33-
new Person { Name = "Orchid" },
34-
new Person { Name = "15" },
35-
new Person { Name = "Flame" },
36-
new Person { Name = "16" },
37-
new Person { Name = "Arrow" },
38-
new Person { Name = "Tempest" },
39-
new Person { Name = "23" },
40-
new Person { Name = "Pearl" },
41-
new Person { Name = "Hydra" },
42-
new Person { Name = "Lamp Post" },
43-
new Person { Name = "4" },
44-
new Person { Name = "Looking Glass" },
45-
new Person { Name = "8" },
30+
new Employee { Name = "Staff" },
31+
new Employee { Name = "42" },
32+
new Employee { Name = "Swan" },
33+
new Employee { Name = "Orchid" },
34+
new Employee { Name = "15" },
35+
new Employee { Name = "Flame" },
36+
new Employee { Name = "16" },
37+
new Employee { Name = "Arrow" },
38+
new Employee { Name = "Tempest" },
39+
new Employee { Name = "23" },
40+
new Employee { Name = "Pearl" },
41+
new Employee { Name = "Hydra" },
42+
new Employee { Name = "Lamp Post" },
43+
new Employee { Name = "4" },
44+
new Employee { Name = "Looking Glass" },
45+
new Employee { Name = "8" },
4646
};
4747

4848
// right list
4949
var acv = new AdvancedCollectionView(Original);
5050
int nul;
51-
acv.Filter = x => !int.TryParse(((Person)x).Name, out nul);
51+
acv.Filter = x => !int.TryParse(((Employee)x).Name, out nul);
5252
acv.SortDescriptions.Add(new SortDescription("Name", SortDirection.Ascending));
5353

5454
CollectionView = acv;
@@ -58,19 +58,19 @@ private void Add_Click(object sender, RoutedEventArgs e)
5858
{
5959
if (!string.IsNullOrWhiteSpace(NewItemBox.Text))
6060
{
61-
Original.Insert(0, new Person { Name = NewItemBox.Text });
61+
Original.Insert(0, new Employee { Name = NewItemBox.Text });
6262
NewItemBox.Text = "";
6363
}
6464
}
65+
}
6566

67+
/// <summary>
68+
/// A sample class used to show how to use the <see cref="AdvancedCollectionView"/> class.
69+
/// </summary>
70+
public partial class Employee
71+
{
6672
/// <summary>
67-
/// A sample class used to show how to use the <see cref="IIncrementalSource{TSource}"/> interface.
73+
/// Gets or sets the name of the person.
6874
/// </summary>
69-
public class Person
70-
{
71-
/// <summary>
72-
/// Gets or sets the name of the person.
73-
/// </summary>
74-
public string? Name { get; set; }
75-
}
75+
public string? Name { get; set; }
7676
}

0 commit comments

Comments
 (0)