From 445f25b55947217b0dccc861af6000c0fdbfa293 Mon Sep 17 00:00:00 2001 From: xiaoy312 Date: Thu, 25 Jul 2024 11:07:54 -0400 Subject: [PATCH] chore: build fix --- src/Uno.UI.Maps/MapPresenter.cs | 2 +- .../Tests/TemplatedParent/Setup/Uno12624.xaml.cs | 8 ++++++++ .../Tests/TemplatedParent/Setup/Uno17313.xaml.cs | 8 ++++---- .../Tests/TemplatedParent/Setup/Uno9059.xaml.cs | 2 +- src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.cs | 2 +- src/Uno.UI/UI/Xaml/Controls/Pivot/PivotAdapter.Android.cs | 2 -- .../UI/Xaml/Controls/Pivot/PivotItemFragment.Android.cs | 1 - .../ScrollContentPresenter/ScrollContentPresenter.wasm.cs | 4 ++-- 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Uno.UI.Maps/MapPresenter.cs b/src/Uno.UI.Maps/MapPresenter.cs index 2094b25dbeff..9834068782a9 100644 --- a/src/Uno.UI.Maps/MapPresenter.cs +++ b/src/Uno.UI.Maps/MapPresenter.cs @@ -25,7 +25,7 @@ private void UpdateOwnerSubscriptions() { _ownerSubscription.Disposable = null; - _owner = TemplatedParent as MapControl; + _owner = GetTemplatedParent() as MapControl; if (_owner != null) { diff --git a/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno12624.xaml.cs b/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno12624.xaml.cs index 206d68f891b0..bc0d3e6dac5f 100644 --- a/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno12624.xaml.cs +++ b/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno12624.xaml.cs @@ -21,7 +21,11 @@ public partial class Uno12624_LeftRightControl : Control typeof(Uno12624_LeftRightControl), new PropertyMetadata(default(object))); +#if !__ANDROID__ public object Left +#else + public new object Left +#endif { get => (object)GetValue(LeftProperty); set => SetValue(LeftProperty, value); @@ -36,7 +40,11 @@ public object Left typeof(Uno12624_LeftRightControl), new PropertyMetadata(default(object))); +#if !__ANDROID__ public object Right +#else + public new object Right +#endif { get => (object)GetValue(RightProperty); set => SetValue(RightProperty, value); diff --git a/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno17313.xaml.cs b/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno17313.xaml.cs index 9f6a79febfcf..b048df3e5020 100644 --- a/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno17313.xaml.cs +++ b/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno17313.xaml.cs @@ -11,7 +11,7 @@ public Uno17313() } } -public class Uno17313_HeaderedCC : ContentControl +public partial class Uno17313_HeaderedCC : ContentControl { #region DependencyProperty: Header @@ -45,6 +45,6 @@ public DataTemplate HeaderTemplate #endregion } -public class Uno17313_Expander : Uno17313_HeaderedCC { } -public class Uno17313_SettingsExpander : Uno17313_HeaderedCC { } -public class Uno17313_SettingsCard : Uno17313_HeaderedCC { } +public partial class Uno17313_Expander : Uno17313_HeaderedCC { } +public partial class Uno17313_SettingsExpander : Uno17313_HeaderedCC { } +public partial class Uno17313_SettingsCard : Uno17313_HeaderedCC { } diff --git a/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno9059.xaml.cs b/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno9059.xaml.cs index 93ab4f72cd1d..d763c215c31c 100644 --- a/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno9059.xaml.cs +++ b/src/Uno.UI.RuntimeTests/Tests/TemplatedParent/Setup/Uno9059.xaml.cs @@ -25,7 +25,7 @@ public Uno9059_VM(Action action) public Uno9059_RelayCommand CustomCommand { get; set; } } -public class Uno9059_CustomControl : Control +public partial class Uno9059_CustomControl : Control { #region DependencyProperty: Action1 diff --git a/src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.cs b/src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.cs index dadf1b5eb71e..b1c1f3f409e8 100644 --- a/src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.cs +++ b/src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.cs @@ -250,7 +250,7 @@ protected override void OnApplyTemplate() static void OnToolBarSizeChanged(object sender, SizeChangedEventArgs args) { // Patches pointer event dispatch on a 0x0 Canvas - if (sender is UIElement { TemplatedParent: DiagnosticsOverlay { TemplatedRoot: Canvas canvas } }) + if (sender is UIElement uie && uie.GetTemplatedParent() is DiagnosticsOverlay { TemplatedRoot: Canvas canvas }) { canvas.Width = args.NewSize.Width; } diff --git a/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotAdapter.Android.cs b/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotAdapter.Android.cs index 1f82962f9643..23315c079e53 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotAdapter.Android.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotAdapter.Android.cs @@ -37,7 +37,6 @@ public void OnDataContextChanged() foreach (var fragment in _fragments) { fragment.DataContext = _pivot.DataContext; - fragment.TemplatedParent = (IFrameworkElement)_pivot.GetTemplatedParent(); } } @@ -84,7 +83,6 @@ private void UpdateAdapter() var fragment = new PivotItemFragment(pivotItem) { DataContext = _pivot.DataContext, - TemplatedParent = (IFrameworkElement)_pivot.GetTemplatedParent() }; return fragment; }) diff --git a/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotItemFragment.Android.cs b/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotItemFragment.Android.cs index 09b963374f2a..4292137153ee 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotItemFragment.Android.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Pivot/PivotItemFragment.Android.cs @@ -64,7 +64,6 @@ private void Update() if (UserVisibleHint && _created && _item != null) { _item.DataContext = _dataContext; - _item.SetTemplatedParent(_templatedParent); } } diff --git a/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.wasm.cs index dfd82683bfd9..a77cba41f6cf 100644 --- a/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.wasm.cs @@ -203,7 +203,7 @@ private void OnPointerWheelChanged(object _, PointerRoutedEventArgs args) private void RestoreScroll() { - if (TemplatedParent is ScrollViewer sv) + if (GetTemplatedParent() is ScrollViewer sv) { if (sv.HorizontalOffset > 0 || sv.VerticalOffset > 0) { @@ -308,7 +308,7 @@ internal bool Set( // If those values are invalid, the browser will raise the final event anyway. // Note: If the caller has allowed animation, we assume that it's not interested by a sync response, // we prefer to wait for the browser to effectively scroll. - (TemplatedParent as ScrollViewer)?.OnPresenterScrolled( + (GetTemplatedParent() as ScrollViewer)?.OnPresenterScrolled( horizontalOffset ?? nativeHorizontalOffset, verticalOffset ?? nativeVerticalOffset, isIntermediate: false