diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue10949.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue10949.cs new file mode 100644 index 00000000000..d2b98464cd0 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue10949.cs @@ -0,0 +1,51 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System; +using System.Collections.ObjectModel; + +#if UITEST +using Xamarin.Forms.Core.UITests; +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + +#if UITEST + [Category(UITestCategories.ActivityIndicator)] +#endif + + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Github, 10949, "UWP replace Progressbar with ProgressRing", PlatformAffected.UWP)] + public class Issue10949 : ContentPage + { + public Issue10949() + { + var loadingLabel = new Label + { + Text = "Loading" + }; + + var activityIndicator = new ActivityIndicator() + { + IsRunning = true, + IsVisible = true, + WidthRequest = 100, + HeightRequest = 100, + Color = Color.Red, + BackgroundColor = Color.Yellow + }; + // Build the page. + Content = new StackLayout + { + Orientation = StackOrientation.Vertical, + Children = + { + loadingLabel, + activityIndicator + } + }; + } + } +} diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 15cf629313f..20be7de861e 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -9,6 +9,7 @@ Xamarin.Forms.Controls.Issues + Github9536.xaml diff --git a/Xamarin.Forms.Platform.UAP/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.UAP/ActivityIndicatorRenderer.cs index 547c6bb47e4..aa1995ef0aa 100644 --- a/Xamarin.Forms.Platform.UAP/ActivityIndicatorRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/ActivityIndicatorRenderer.cs @@ -1,9 +1,10 @@ using System.ComponentModel; using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; namespace Xamarin.Forms.Platform.UWP { - public class ActivityIndicatorRenderer : ViewRenderer + public class ActivityIndicatorRenderer : ViewRenderer { object _foregroundDefault; @@ -15,7 +16,13 @@ protected override void OnElementChanged(ElementChangedEventArgs : ViewRenderer (UWPDataTemplate)UWPApp.Current.Resources["View"]; - protected UWPDataTemplate ItemsViewTemplate => (UWPDataTemplate)UWPApp.Current.Resources["ItemsViewDefaultTemplate"]; + protected UwpDataTemplate ViewTemplate => (UwpDataTemplate)UwpApp.Current.Resources["View"]; + protected UwpDataTemplate ItemsViewTemplate => (UwpDataTemplate)UwpApp.Current.Resources["ItemsViewDefaultTemplate"]; protected ItemsViewRenderer() { @@ -392,6 +395,31 @@ protected virtual void UpdateEmptyView() UpdateEmptyViewVisibility(); } + protected virtual void UpdateItemsLayout() + { + if (_scrollViewer != null) + _scrollViewer.ViewChanged -= OnScrollViewChanged; + + if (ListViewBase != null) + { + ListViewBase.ItemsSource = null; + ListViewBase = null; + } + + ListViewBase = SelectListViewBase(); + ListViewBase.IsSynchronizedWithCurrentItem = false; + + FindScrollViewer(ListViewBase); + + SetNativeControl(ListViewBase); + + UpdateItemTemplate(); + UpdateItemsSource(); + UpdateVerticalScrollBarVisibility(); + UpdateHorizontalScrollBarVisibility(); + UpdateEmptyView(); + } + FrameworkElement RealizeEmptyViewTemplate(object bindingContext, DataTemplate emptyViewTemplate) { if (emptyViewTemplate == null) @@ -499,4 +527,4 @@ void OnScrollViewChanged(object sender, ScrollViewerViewChangedEventArgs e) HandleScroll(_scrollViewer); } } -} +} \ No newline at end of file diff --git a/Xamarin.Forms.Platform.UAP/CollectionView/StructuredItemsViewRenderer.cs b/Xamarin.Forms.Platform.UAP/CollectionView/StructuredItemsViewRenderer.cs index fa41e03fffe..44f98a6dd5f 100644 --- a/Xamarin.Forms.Platform.UAP/CollectionView/StructuredItemsViewRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/CollectionView/StructuredItemsViewRenderer.cs @@ -1,6 +1,8 @@ using System; using System.ComponentModel; + using Windows.UI.Xaml.Controls; + using UWPApp = Windows.UI.Xaml.Application; using WListView = Windows.UI.Xaml.Controls.ListView; using WScrollMode = Windows.UI.Xaml.Controls.ScrollMode; @@ -43,6 +45,10 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE { UpdateFooter(); } + else if (changedProperty.Is(StructuredItemsView.ItemsLayoutProperty)) + { + UpdateItemsLayout(); + } } protected override ListViewBase SelectListViewBase() @@ -57,7 +63,7 @@ protected override ListViewBase SelectListViewBase() return CreateHorizontalListView(listItemsLayout); } - throw new NotImplementedException("The layout is not implemented"); + throw new NotImplementedException("The layout is not implemented"); } protected virtual void UpdateHeader() diff --git a/Xamarin.Forms.Platform.UAP/FormsProgressBar.cs b/Xamarin.Forms.Platform.UAP/FormsProgressBar.cs deleted file mode 100644 index 83e10fc19ec..00000000000 --- a/Xamarin.Forms.Platform.UAP/FormsProgressBar.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Windows.UI.Xaml; - -namespace Xamarin.Forms.Platform.UWP -{ - public class FormsProgressBar : Windows.UI.Xaml.Controls.ProgressBar - { - public static readonly DependencyProperty ElementOpacityProperty = DependencyProperty.Register( - nameof(ElementOpacity), typeof(double), typeof(FormsProgressBar), new PropertyMetadata(default(double))); - - public double ElementOpacity - { - get { return (double)GetValue(ElementOpacityProperty); } - set { SetValue(ElementOpacityProperty, value); } - } - - protected override Windows.Foundation.Size MeasureOverride(Windows.Foundation.Size availableSize) - { - var result = base.MeasureOverride(availableSize); - if (!double.IsInfinity(availableSize.Width)) - result.Width = availableSize.Width; - return result; - } - } -} diff --git a/Xamarin.Forms.Platform.UAP/FormsProgressBarStyle.xaml b/Xamarin.Forms.Platform.UAP/FormsProgressBarStyle.xaml deleted file mode 100644 index 1d2ea194e7c..00000000000 --- a/Xamarin.Forms.Platform.UAP/FormsProgressBarStyle.xaml +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - diff --git a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj index 7513b7686a0..0482cdfd6ba 100644 --- a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj +++ b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj @@ -48,10 +48,6 @@ Designer MSBuild:Compile - - MSBuild:Compile - Designer - Designer MSBuild:Compile