Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit eb4ae07

Browse files
committed
Merge branch '4.3.0' into 4.4.0
# Conflicts: # EmbeddingTestBeds/Embedding.UWP/Embedding.UWP.csproj # PagesGallery/PagesGallery.Droid/PagesGallery.Droid.csproj # PagesGallery/PagesGallery.UWP/PagesGallery.UWP.csproj # Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj # Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems # Xamarin.Forms.Maps.UWP/Xamarin.Forms.Maps.UWP.csproj # Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj
2 parents 9d096f6 + 50612ef commit eb4ae07

File tree

20 files changed

+245
-31
lines changed

20 files changed

+245
-31
lines changed

EmbeddingTestBeds/Embedding.UWP/Embedding.UWP.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,4 @@
164164
<Target Name="AfterBuild">
165165
</Target>
166166
-->
167-
</Project>
167+
</Project>

PagesGallery/PagesGallery.Droid/PagesGallery.Droid.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
</ItemGroup>
119119
<ItemGroup>
120120
<PackageReference Include="Microsoft.Azure.Mobile.Client">
121-
<Version>4.0.2</Version>
121+
<Version>4.1.1</Version>
122122
</PackageReference>
123123
<PackageReference Include="Microsoft.Bcl.Build">
124124
<Version>1.0.21</Version>
@@ -130,7 +130,7 @@
130130
<Version>4.3.0</Version>
131131
</PackageReference>
132132
<PackageReference Include="Newtonsoft.Json">
133-
<Version>10.0.3</Version>
133+
<Version>11.0.2</Version>
134134
</PackageReference>
135135
<PackageReference Include="System.AppContext">
136136
<Version>4.3.0</Version>
@@ -283,4 +283,4 @@
283283
<PackageReference Include="Xamarin.Android.Support.Vector.Drawable" Version="28.0.0.3" />
284284
</ItemGroup>
285285
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
286-
</Project>
286+
</Project>

PagesGallery/PagesGallery.UWP/PagesGallery.UWP.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,4 @@
164164
<VisualStudioVersion>14.0</VisualStudioVersion>
165165
</PropertyGroup>
166166
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
167-
</Project>
167+
</Project>

PagesGallery/PagesGallery.iOS/PagesGallery.iOS.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@
139139
<Reference Include="Xamarin.iOS" />
140140
</ItemGroup>
141141
<ItemGroup>
142-
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.0.2" />
143-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
142+
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.1.1" />
143+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
144144
<PackageReference Include="Xamarin.iOS.MaterialComponents" Version="72.2.0.1" />
145145
</ItemGroup>
146146
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
147-
</Project>
147+
</Project>

Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318
</ItemGroup>
319319
<ItemGroup>
320320
<PackageReference Include="Newtonsoft.Json">
321-
<Version>10.0.3</Version>
321+
<Version>11.0.2</Version>
322322
</PackageReference>
323323
<PackageReference Include="NUnit">
324324
<Version>3.12.0</Version>

Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -73,7 +73,7 @@
7373
<Reference Include="OpenTK" />
7474
</ItemGroup>
7575
<ItemGroup>
76-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
76+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
7777
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
7878
</ItemGroup>
7979
<ItemGroup>
@@ -407,9 +407,7 @@
407407
<ItemGroup>
408408
<InterfaceDefinition Include="Main.storyboard" />
409409
</ItemGroup>
410-
<ItemGroup>
411-
<Folder Include="Resources\Fonts\" />
412-
</ItemGroup>
410+
<ItemGroup />
413411
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
414412
<Target Name="_VerifyBuildSignature" />
415-
</Project>
413+
</Project>

Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
<Version>2.1.190606001</Version>
244244
</PackageReference>
245245
<PackageReference Include="Newtonsoft.Json">
246-
<Version>10.0.3</Version>
246+
<Version>11.0.2</Version>
247247
</PackageReference>
248248
<PackageReference Include="Xam.Plugin.DeviceInfo">
249249
<Version>3.0.2</Version>
@@ -270,4 +270,4 @@
270270
<Target Name="AfterBuild">
271271
</Target>
272272
-->
273-
</Project>
273+
</Project>

Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
</ItemGroup>
357357
<ItemGroup>
358358
<PackageReference Include="AdvancedColorPicker" Version="2.0.1" />
359-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
359+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
360360
<PackageReference Include="NUnit">
361361
<Version>3.12.0</Version>
362362
</PackageReference>
@@ -414,4 +414,4 @@
414414
</ItemGroup>
415415
<ItemGroup />
416416
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
417-
</Project>
417+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
using System.Collections.ObjectModel;
2+
using System.Threading.Tasks;
3+
using System.Windows.Input;
4+
using Xamarin.Forms.CustomAttributes;
5+
using Xamarin.Forms.Internals;
6+
7+
#if UITEST
8+
using Xamarin.Forms.Core.UITests;
9+
using Xamarin.UITest;
10+
using NUnit.Framework;
11+
#endif
12+
13+
namespace Xamarin.Forms.Controls.Issues
14+
{
15+
[Preserve(AllMembers = true)]
16+
[Issue(IssueTracker.Bugzilla, 8392, "[Bug] CollectionView does not marshal ObservableCollection.CollectionChanged to MainThread")]
17+
public class Issue8392 : TestContentPage
18+
{
19+
public Issue8392()
20+
{
21+
Title = "Issue 8392";
22+
23+
var collectionView = new CollectionView
24+
{
25+
ItemTemplate = new Issue8392DataTemplate()
26+
};
27+
28+
collectionView.SetBinding(ItemsView.ItemsSourceProperty, nameof(Issue8392ViewModel.DataList));
29+
30+
var refreshView = new RefreshView
31+
{
32+
Content = collectionView
33+
};
34+
35+
refreshView.SetBinding(RefreshView.IsRefreshingProperty, nameof(Issue8392ViewModel.IsRefreshing));
36+
refreshView.SetBinding(RefreshView.CommandProperty, nameof(Issue8392ViewModel.PullToRefreshCommand));
37+
38+
Content = refreshView;
39+
40+
BindingContext = new Issue8392ViewModel();
41+
}
42+
43+
protected override void Init()
44+
{
45+
46+
}
47+
48+
protected override void OnAppearing()
49+
{
50+
base.OnAppearing();
51+
52+
if (Content is RefreshView refreshView
53+
&& refreshView.Content is CollectionView)
54+
{
55+
refreshView.IsRefreshing = true;
56+
}
57+
}
58+
}
59+
60+
[Preserve(AllMembers = true)]
61+
public class Issue8392DataTemplate : DataTemplate
62+
{
63+
public Issue8392DataTemplate() : base(CreateTemplate)
64+
{
65+
}
66+
67+
static Layout CreateTemplate()
68+
{
69+
var numberLabel = new Label
70+
{
71+
FontSize = 14,
72+
HorizontalOptions = LayoutOptions.Start,
73+
VerticalOptions = LayoutOptions.Center,
74+
HorizontalTextAlignment = TextAlignment.Start,
75+
VerticalTextAlignment = TextAlignment.Center,
76+
};
77+
numberLabel.SetBinding(Label.TextProperty, nameof(Issue8392Model.Number));
78+
79+
var grid = new Grid
80+
{
81+
RowDefinitions =
82+
{
83+
new RowDefinition { Height = new GridLength(20,GridUnitType.Absolute) }
84+
},
85+
ColumnDefinitions =
86+
{
87+
new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
88+
}
89+
};
90+
91+
grid.Children.Add(numberLabel, 0, 0);
92+
93+
return grid;
94+
}
95+
}
96+
97+
public class Issue8392Model
98+
{
99+
public Issue8392Model(int number) => Number = number;
100+
101+
public int Number { get; }
102+
}
103+
104+
[Preserve(AllMembers = true)]
105+
public class Issue8392ViewModel : BindableObject
106+
{
107+
bool _isRefreshing;
108+
109+
public ICommand PullToRefreshCommand => new Command(async () => await ExecutePullToRefreshCommand());
110+
111+
public bool IsRefreshing
112+
{
113+
get { return _isRefreshing; }
114+
set
115+
{
116+
_isRefreshing = value;
117+
OnPropertyChanged();
118+
}
119+
}
120+
121+
public ObservableCollection<Issue8392Model> DataList { get; } = new ObservableCollection<Issue8392Model>();
122+
123+
async Task ExecutePullToRefreshCommand()
124+
{
125+
DataList.Clear();
126+
127+
try
128+
{
129+
// If the items load without exception, the test has passed.
130+
for (int i = 0; i < 30; i++)
131+
{
132+
await Task.Delay(200).ConfigureAwait(false);
133+
DataList.Add(new Issue8392Model(i + 1));
134+
}
135+
}
136+
finally
137+
{
138+
IsRefreshing = false;
139+
}
140+
}
141+
}
142+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems

+1
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@
11771177
<Compile Include="$(MSBuildThisFileDirectory)Issue8693.cs" />
11781178
<Compile Include="$(MSBuildThisFileDirectory)Issue7813.xaml.cs" />
11791179
<Compile Include="$(MSBuildThisFileDirectory)Issue8638.xaml.cs" />
1180+
<Compile Include="$(MSBuildThisFileDirectory)Issue8392.cs" />
11801181
<Compile Include="$(MSBuildThisFileDirectory)Issue8672.cs" />
11811182
<Compile Include="$(MSBuildThisFileDirectory)Issue8326.xaml.cs" />
11821183
<Compile Include="$(MSBuildThisFileDirectory)Issue8449.xaml.cs" />

Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
<EmbeddedResource Include="BuildNumber.txt" />
3535
<EmbeddedResource Include="GalleryPages\crimson.jpg" />
3636
<EmbeddedResource Include="coffee.png" />
37-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
3837
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
3938
<PackageReference Include="NUnit" Version="3.12.0" />
39+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
4040
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
4141
</ItemGroup>
4242

Xamarin.Forms.Maps.GTK/Xamarin.Forms.Maps.GTK.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<Reference Include="System.Xml" />
8484
</ItemGroup>
8585
<ItemGroup>
86-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
86+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
8787
</ItemGroup>
8888
<ItemGroup>
8989
<Compile Include="FormsMaps.cs" />

Xamarin.Forms.Pages.Azure/Xamarin.Forms.Pages.Azure.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageReference Include="Microsoft.Azure.Mobile.Client">
7-
<Version>4.0.2</Version>
7+
<Version>4.1.1</Version>
88
</PackageReference>
99
</ItemGroup>
1010
<ItemGroup>

Xamarin.Forms.Pages/Xamarin.Forms.Pages.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99
<ItemGroup>
1010
<PackageReference Include="Newtonsoft.Json">
11-
<Version>10.0.3</Version>
11+
<Version>11.0.2</Version>
1212
</PackageReference>
1313
</ItemGroup>
1414
<ItemGroup>

Xamarin.Forms.Platform.Android/CollectionView/ObservableGroupedSource.cs

+17-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ internal class ObservableGroupedSource : IGroupableItemsViewSource, ICollectionC
1010
readonly ICollectionChangedNotifier _notifier;
1111
readonly IList _groupSource;
1212
List<IItemsViewSource> _groups = new List<IItemsViewSource>();
13+
readonly bool _hasGroupHeaders;
14+
readonly bool _hasGroupFooters;
1315
bool _disposed;
1416

15-
bool _hasGroupHeaders;
16-
bool _hasGroupFooters;
17-
1817
public int Count
1918
{
2019
get
@@ -42,14 +41,14 @@ public ObservableGroupedSource(GroupableItemsView groupableItemsView, ICollectio
4241
_notifier = notifier;
4342
_groupSource = groupSource as IList ?? new ListSource(groupSource);
4443

44+
_hasGroupFooters = groupableItemsView.GroupFooterTemplate != null;
45+
_hasGroupHeaders = groupableItemsView.GroupHeaderTemplate != null;
46+
4547
if (_groupSource is INotifyCollectionChanged incc)
4648
{
4749
incc.CollectionChanged += CollectionChanged;
4850
}
4951

50-
_hasGroupFooters = groupableItemsView.GroupFooterTemplate != null;
51-
_hasGroupHeaders = groupableItemsView.GroupHeaderTemplate != null;
52-
5352
UpdateGroupTracking();
5453
}
5554

@@ -231,6 +230,18 @@ void ClearGroupTracking()
231230
}
232231

233232
void CollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
233+
{
234+
if (Device.IsInvokeRequired)
235+
{
236+
Device.BeginInvokeOnMainThread(() => CollectionChanged(args));
237+
}
238+
else
239+
{
240+
CollectionChanged(args);
241+
}
242+
}
243+
244+
void CollectionChanged(NotifyCollectionChangedEventArgs args)
234245
{
235246
switch (args.Action)
236247
{

Xamarin.Forms.Platform.Android/CollectionView/ObservableItemsSource.cs

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public ObservableItemsSource(IEnumerable itemSource, ICollectionChangedNotifier
1414
{
1515
_itemsSource = itemSource as IList ?? itemSource as IEnumerable;
1616
_notifier = notifier;
17+
1718
((INotifyCollectionChanged)itemSource).CollectionChanged += CollectionChanged;
1819
}
1920

@@ -81,6 +82,18 @@ int AdjustPositionForHeader(int position)
8182
}
8283

8384
void CollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
85+
{
86+
if (Device.IsInvokeRequired)
87+
{
88+
Device.BeginInvokeOnMainThread(() => CollectionChanged(args));
89+
}
90+
else
91+
{
92+
CollectionChanged(args);
93+
}
94+
}
95+
96+
void CollectionChanged(NotifyCollectionChangedEventArgs args)
8497
{
8598
switch (args.Action)
8699
{

0 commit comments

Comments
 (0)