From fbf8c4139b4a4eb357c90f66f941004296b116ee Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Wed, 12 Jun 2019 15:32:13 -0400 Subject: [PATCH 1/4] VS 16.2 compatibility updates --- src/Uno.UI/Controls/BindableImageView.Android.cs | 1 - .../UI/Xaml/Controls/BorderLayerRenderer.Android.cs | 9 ++++----- src/Uno.UI/UI/Xaml/Controls/Panel/Panel.Android.cs | 1 - src/Uno.UI/UI/Xaml/Media/ImageSource.Android.cs | 9 ++++----- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Uno.UI/Controls/BindableImageView.Android.cs b/src/Uno.UI/Controls/BindableImageView.Android.cs index b780011fb24d..928238d7f3a0 100644 --- a/src/Uno.UI/Controls/BindableImageView.Android.cs +++ b/src/Uno.UI/Controls/BindableImageView.Android.cs @@ -24,7 +24,6 @@ using Java.Lang.Ref; using System.IO; using Math = System.Math; -using System.Drawing; using Size = System.Drawing.Size; using System.Reflection; using Windows.UI.Core; diff --git a/src/Uno.UI/UI/Xaml/Controls/BorderLayerRenderer.Android.cs b/src/Uno.UI/UI/Xaml/Controls/BorderLayerRenderer.Android.cs index 0eaf19abe43f..3a07b0e2edc4 100644 --- a/src/Uno.UI/UI/Xaml/Controls/BorderLayerRenderer.Android.cs +++ b/src/Uno.UI/UI/Xaml/Controls/BorderLayerRenderer.Android.cs @@ -10,7 +10,6 @@ using Windows.UI.Xaml.Media; using System; using System.Collections.Generic; -using System.Drawing; using Uno.Disposables; using System.Text; using System.Threading; @@ -51,7 +50,7 @@ public void UpdateLayers( // This is required because android Height and Width are hidden by Control. var baseView = view as View; - Size targetSize = new Size(baseView.Width, baseView.Height); + var targetSize = new global::System.Drawing.Size(baseView.Width, baseView.Height); var drawArea = new Windows.Foundation.Rect(0, 0, targetSize.Width, targetSize.Height); var newState = new LayoutState(drawArea, background, borderThickness, borderBrush, cornerRadius, padding); var previousLayoutState = _currentState; @@ -239,7 +238,7 @@ Action onImageSet { using (var strokePaint = new Paint(borderBrush.GetStrokePaint(drawArea))) { - var overlay = GetOverlayDrawable(strokePaint, physicalBorderThickness, new Size((int)drawArea.Width, (int)drawArea.Height), path); + var overlay = GetOverlayDrawable(strokePaint, physicalBorderThickness, new global::System.Drawing.Size((int)drawArea.Width, (int)drawArea.Height), path); if (overlay != null) { @@ -274,7 +273,7 @@ Action onImageSet //TODO: Handle case that BorderBrush is an ImageBrush using (var strokePaint = borderBrush.GetStrokePaint(drawArea)) { - var overlay = GetOverlayDrawable(strokePaint, physicalBorderThickness, new Size(view.Width, view.Height)); + var overlay = GetOverlayDrawable(strokePaint, physicalBorderThickness, new global::System.Drawing.Size(view.Width, view.Height)); if (overlay != null) { @@ -423,7 +422,7 @@ private static void ExecuteWithNoRelayout(BindableView target, Action, Bitmap> _resourceCache = new Dictionary, Bitmap>(); + private static Dictionary, Bitmap> _resourceCache = new Dictionary, Bitmap>(); /// /// Defines an asynchronous image loader handler. @@ -35,7 +34,7 @@ public partial class ImageSource /// The image uri /// An optional target decoding size /// A Bitmap instance - public delegate Task ImageLoaderHandler(CancellationToken ct, string uri, Android.Widget.ImageView imageView, Size? targetSize); + public delegate Task ImageLoaderHandler(CancellationToken ct, string uri, Android.Widget.ImageView imageView, global::System.Drawing.Size? targetSize); /// /// Provides a optional external image loader. @@ -131,7 +130,7 @@ internal async Task Open(CancellationToken ct, Android.Widget.ImageView options.InJustDecodeBounds = true; var targetSize = UseTargetSize && targetWidth != null && targetHeight != null - ? (Size?)new Size(targetWidth.Value, targetHeight.Value) + ? (global::System.Drawing.Size?)new global::System.Drawing.Size(targetWidth.Value, targetHeight.Value) : null; if (ResourceId.HasValue) @@ -273,7 +272,7 @@ private static bool IsContactUri(Uri uri) /// /// /// - private async Task FetchResourceWithDownsampling(CancellationToken ct, int resourceId, Size? targetSize) + private async Task FetchResourceWithDownsampling(CancellationToken ct, int resourceId, global::System.Drawing.Size? targetSize) { var key = Tuple.Create(resourceId, targetSize); From a36b276f6dcd5af701bb08dc7d70c2d469d18a8a Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Wed, 12 Jun 2019 15:33:21 -0400 Subject: [PATCH 2/4] Fix iOS items dependency property propagation --- .../UITests.Shared/UITests.Shared.projitems | 8 ++++ .../ListView_DataContext_Propagation.xaml | 48 +++++++++++++++++++ .../ListView_DataContext_Propagation.xaml.cs | 34 +++++++++++++ .../ListViewBase/ListViewBaseSource.iOS.cs | 6 ++- 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml create mode 100644 src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml.cs diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems index f6aa7400cf67..42a08ee84254 100644 --- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems +++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems @@ -697,6 +697,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -2248,6 +2252,7 @@ ListViewResizableText.xaml + ListView_Infinite_Breadth.xaml @@ -3155,6 +3160,9 @@ PivotSimpleTest.xaml + + ListView_DataContext_Propagation.xaml + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml new file mode 100644 index 000000000000..6870dba63136 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + Item 01 + Item 02 + + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml.cs new file mode 100644 index 000000000000..cb331d9872ed --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ListView/ListView_DataContext_Propagation.xaml.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Uno.UI.Samples.Controls; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 + +namespace UITests.Shared.Windows_UI_Xaml_Controls.ListView +{ + [SampleControlInfo("ListView", "ListView_DataContext_Propagation")] + public sealed partial class ListView_DataContext_Propagation : UserControl + { + public ListView_DataContext_Propagation() + { + this.InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + topGrid.DataContext = "Button Clicked " + sender.ToString(); + } + } +} diff --git a/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBaseSource.iOS.cs b/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBaseSource.iOS.cs index 7f680014d356..da432cb7ee2d 100644 --- a/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBaseSource.iOS.cs +++ b/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBaseSource.iOS.cs @@ -229,7 +229,11 @@ public override UICollectionViewCell GetCell(UICollectionView collectionView, NS } FrameworkElement.InitializePhaseBinding(selectorItem); - } + + // Ensure the item has a parent, since it's added to the native collection view + // which does not automatically sets the parent DependencyObject. + selectorItem.SetParent(Owner?.XamlParent); + } else if (this.Log().IsEnabled(Microsoft.Extensions.Logging.LogLevel.Debug)) { this.Log().Debug($"Reusing view at indexPath={indexPath}, previously bound to {selectorItem.DataContext}."); From e14a8a1ea17dd764eebc389281fb28a1e7a17121 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Wed, 12 Jun 2019 15:50:27 -0400 Subject: [PATCH 3/4] Update release notes --- doc/ReleaseNotes/_ReleaseNotes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/ReleaseNotes/_ReleaseNotes.md b/doc/ReleaseNotes/_ReleaseNotes.md index d32972b0acb8..713380618500 100644 --- a/doc/ReleaseNotes/_ReleaseNotes.md +++ b/doc/ReleaseNotes/_ReleaseNotes.md @@ -84,6 +84,7 @@ * `Grid` now supports `ColumnDefinition.MinWidth` and `MaxWidth` and `RowDefinition.MinHeight` and `MaxHeight` (#1032) * Implement the `PivotPanel` measure/arrange to allow text wrapping in pivot items * [Wasm] Add `PathIcon` support +* [iOS] Fix items dependency property propagation in ListView items ### Breaking Changes * The `WebAssemblyRuntime.InvokeJSUnmarshalled` method with three parameters has been removed. From fc43b72f77b937430301a5cfbf452fedaf5e6c06 Mon Sep 17 00:00:00 2001 From: Geoffrey Huntley Date: Wed, 19 Jun 2019 15:27:42 +1000 Subject: [PATCH 4/4] corrected absolute paths --- src/SamplesApp/UITests.Shared/UITests.Shared.projitems | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems index 42a08ee84254..153f70a61ca2 100644 --- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems +++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems @@ -3157,10 +3157,10 @@ Simpletwocolumnsplitgrid.xaml - + PivotSimpleTest.xaml - + ListView_DataContext_Propagation.xaml @@ -3191,4 +3191,4 @@ - \ No newline at end of file +