summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2017-03-14 06:00:10 -0500
committerRui Marinho <me@ruimarinho.net>2017-03-14 11:00:10 +0000
commit83fd2751e6939eb76a4ecd8b098144afaa2d289f (patch)
treec0875957260af9107e49b09f82911893157716f3 /Xamarin.Forms.Platform.WinRT
parent05f0f7610f197ccc862e5a815376c3cd93d0efe8 (diff)
downloadxamarin-forms-83fd2751e6939eb76a4ecd8b098144afaa2d289f.tar.gz
xamarin-forms-83fd2751e6939eb76a4ecd8b098144afaa2d289f.tar.bz2
xamarin-forms-83fd2751e6939eb76a4ecd8b098144afaa2d289f.zip
[WinRT/UWP] Fix Opacity behavior with ProgressBar (#695)
* [WinRT/UWP] Fix Opacity behavior with ProgressBar * Update .nuspec * Further update .nuspec * Adjust .csproj line to fix Mac build
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r--Xamarin.Forms.Platform.WinRT/ActivityIndicatorRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.WinRT/FormsProgressBar.cs22
-rw-r--r--Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj1
3 files changed, 27 insertions, 4 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.WinRT/ActivityIndicatorRenderer.cs
index cfe91f64..eae3f799 100644
--- a/Xamarin.Forms.Platform.WinRT/ActivityIndicatorRenderer.cs
+++ b/Xamarin.Forms.Platform.WinRT/ActivityIndicatorRenderer.cs
@@ -10,7 +10,7 @@ namespace Xamarin.Forms.Platform.UWP
namespace Xamarin.Forms.Platform.WinRT
#endif
{
- public class ActivityIndicatorRenderer : ViewRenderer<ActivityIndicator, Windows.UI.Xaml.Controls.ProgressBar>
+ public class ActivityIndicatorRenderer : ViewRenderer<ActivityIndicator, FormsProgressBar>
{
#if !WINDOWS_UWP
Windows.UI.Xaml.Media.SolidColorBrush _resourceBrush;
@@ -25,7 +25,7 @@ namespace Xamarin.Forms.Platform.WinRT
{
if (Control == null)
{
- SetNativeControl(new Windows.UI.Xaml.Controls.ProgressBar { IsIndeterminate = true });
+ SetNativeControl(new FormsProgressBar { IsIndeterminate = true, Style = Windows.UI.Xaml.Application.Current.Resources["FormsProgressBarStyle"] as Windows.UI.Xaml.Style });
Control.Loaded += OnControlLoaded;
}
@@ -39,7 +39,7 @@ namespace Xamarin.Forms.Platform.WinRT
{
base.OnElementPropertyChanged(sender, e);
- if (e.PropertyName == ActivityIndicator.IsRunningProperty.PropertyName)
+ if (e.PropertyName == ActivityIndicator.IsRunningProperty.PropertyName || e.PropertyName == VisualElement.OpacityProperty.PropertyName)
UpdateIsRunning();
else if (e.PropertyName == ActivityIndicator.ColorProperty.PropertyName)
UpdateColor();
@@ -80,7 +80,7 @@ namespace Xamarin.Forms.Platform.WinRT
void UpdateIsRunning()
{
- Opacity = Element.IsRunning ? 1 : 0;
+ Control.ElementOpacity = Element.IsRunning ? Element.Opacity : 0;
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.WinRT/FormsProgressBar.cs b/Xamarin.Forms.Platform.WinRT/FormsProgressBar.cs
new file mode 100644
index 00000000..f150371a
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/FormsProgressBar.cs
@@ -0,0 +1,22 @@
+using Windows.UI.Xaml;
+
+#if WINDOWS_UWP
+
+namespace Xamarin.Forms.Platform.UWP
+#else
+
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ 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); }
+ }
+ }
+}
diff --git a/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj b/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj
index 339e1924..270a42b6 100644
--- a/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj
+++ b/Xamarin.Forms.Platform.WinRT/Xamarin.Forms.Platform.WinRT.csproj
@@ -102,6 +102,7 @@
<Compile Include="ExportRendererAttribute.cs" />
<Compile Include="FileImageSourcePathConverter.cs" />
<Compile Include="FormsButton.cs" />
+ <Compile Include="FormsProgressBar.cs" />
<Compile Include="FrameRenderer.cs" />
<Compile Include="ImageConverter.cs" />
<Compile Include="KeyboardConverter.cs" />