diff options
15 files changed, 1072 insertions, 4 deletions
diff --git a/.nuspec/Xamarin.Forms.nuspec b/.nuspec/Xamarin.Forms.nuspec index fa933839..d4da6eb9 100644 --- a/.nuspec/Xamarin.Forms.nuspec +++ b/.nuspec/Xamarin.Forms.nuspec @@ -183,6 +183,7 @@ <file src="..\Xamarin.Forms.Platform.WinRT\bin\$Configuration$\StepperControl.xbf" target="lib\wpa81\Xamarin.Forms.Platform.WinRT" /> <file src="..\Xamarin.Forms.Platform.WinRT.Phone\bin\$Configuration$\PhoneResources.xbf" target="lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone" /> + <file src="..\Xamarin.Forms.Platform.WinRT.Phone\bin\$Configuration$\FormsProgressBarStyle.xbf" target="lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone" /> <file src="..\Xamarin.Forms.Platform.WinRT.Phone\bin\$Configuration$\FormsTextBoxStyle.xbf" target="lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone" /> <file src="..\Xamarin.Forms.Platform.WinRT.Phone\bin\$Configuration$\Resources.xbf" target="lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone" /> <file src="..\Xamarin.Forms.Platform.WinRT.Phone\bin\$Configuration$\SearchBox.xbf" target="lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone" /> @@ -207,6 +208,7 @@ <file src="..\Xamarin.Forms.Platform.WinRT.Tablet\bin\$Configuration$\Resources.xbf" target="lib\win81\Xamarin.Forms.Platform.WinRT.Tablet" /> <file src="..\Xamarin.Forms.Platform.WinRT.Tablet\bin\$Configuration$\TabletResources.xbf" target="lib\win81\Xamarin.Forms.Platform.WinRT.Tablet" /> <file src="..\Xamarin.Forms.Platform.WinRT.Tablet\bin\$Configuration$\FormsTextBoxStyle.xbf" target="lib\win81\Xamarin.Forms.Platform.WinRT.Tablet" /> + <file src="..\Xamarin.Forms.Platform.WinRT.Tablet\bin\$Configuration$\FormsProgressBarStyle.xbf" target="lib\win81\Xamarin.Forms.Platform.WinRT.Tablet" /> <file src="..\Xamarin.Forms.Core\bin\$Configuration$\Xamarin.Forms.Core.dll" target="lib\win81" /> <file src="..\docs\Xamarin.Forms.Core.xml" target="lib\win81" /> @@ -222,6 +224,7 @@ <file src="..\Xamarin.Forms.Platform.UAP\Properties\Xamarin.Forms.Platform.UAP.rd.xml" target="lib\uap10.0\Xamarin.Forms.Platform.UAP\Properties" /> <file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\FormsCommandBarStyle.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" /> + <file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\FormsProgressBarStyle.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" /> <file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\PageControl.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" /> <file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\Resources.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" /> <file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\FormsTextBoxStyle.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" /> diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla37290.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla37290.cs new file mode 100644 index 00000000..0f089644 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla37290.cs @@ -0,0 +1,65 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 37290, "[WinRT/UWP] Setting ActivityIndicator.IsRunning=\"false\" shows the ActivityIndicator", PlatformAffected.WinRT)] + public class Bugzilla37290 : TestContentPage + { + protected override void Init() + { + var activityIndicator = new ActivityIndicator + { + IsRunning = false, + Opacity = 0.4 + }; + var opacityStepper = new Stepper + { + Minimum = 0.1, + Maximum = 1.0, + Increment = .1, + Value = 0.4 + }; + var stepperValue = new Label + { + Text = "Current Value: " + opacityStepper.Value.ToString() + }; + opacityStepper.ValueChanged += (s, e) => + { + activityIndicator.Opacity = opacityStepper.Value; + stepperValue.Text = "Current Value: " + opacityStepper.Value.ToString(); + }; + Content = new StackLayout + { + Children = + { + new Label + { + Text = "The activity indicator below should not be initially visible. You can also use the stepper to change its Opacity value." + }, + activityIndicator, + new Button + { + Text = "Click to toggle IsRunning on the ActivityIndicator", + Command = new Command(() => activityIndicator.IsRunning = !activityIndicator.IsRunning) + }, + new StackLayout() + { + Orientation = StackOrientation.Horizontal, + Children = + { + opacityStepper, + stepperValue + } + } + } + }; + } + } +}
\ No newline at end of file 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 8ef92d46..83a5995b 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 @@ -173,6 +173,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla47923.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla48236.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla47971.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla37290.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51553.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51802.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51236.cs" /> diff --git a/Xamarin.Forms.Platform.UAP/FormsProgressBarStyle.xaml b/Xamarin.Forms.Platform.UAP/FormsProgressBarStyle.xaml new file mode 100644 index 00000000..1d2ea194 --- /dev/null +++ b/Xamarin.Forms.Platform.UAP/FormsProgressBarStyle.xaml @@ -0,0 +1,308 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:uwp="using:Xamarin.Forms.Platform.UWP"> + + <!-- Default style for Windows.UI.Xaml.Controls.ProgressBar --> + <Style x:Key="FormsProgressBarStyle" TargetType="uwp:FormsProgressBar"> + <Setter Property="Foreground" Value="{ThemeResource SystemControlHighlightAccentBrush}" /> + <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundBaseLowBrush}" /> + <Setter Property="BorderThickness" Value="{ThemeResource ProgressBarBorderThemeThickness}" /> + <Setter Property="Maximum" Value="100" /> + <Setter Property="MinHeight" Value="{ThemeResource ProgressBarThemeMinHeight}" /> + <Setter Property="IsTabStop" Value="False" /> + <Setter Property="VerticalAlignment" Value="Center" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ProgressBar"> + <Grid> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualStateGroup.Transitions> + <VisualTransition From="Updating" To="Determinate"> + <Storyboard> + <RepositionThemeAnimation TargetName="ProgressBarIndicator" FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.IndicatorLengthDelta}" /> + </Storyboard> + </VisualTransition> + <VisualTransition From="Paused" To="Determinate"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0:0:0.25" /> + </Storyboard> + </VisualTransition> + <VisualTransition From="Indeterminate" To="Determinate"> + <Storyboard> + <FadeInThemeAnimation TargetName="EllipseGrid" /> + </Storyboard> + </VisualTransition> + </VisualStateGroup.Transitions> + <VisualState x:Name="Determinate" /> + <VisualState x:Name="Updating" /> + <VisualState x:Name="Indeterminate"> + <Storyboard RepeatBehavior="Forever"> + <DoubleAnimation Storyboard.TargetName="EllipseGrid" + Duration="0:0:3.917" + Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" + From="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContainerAnimationStartPosition}" + To="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContainerAnimationEndPosition}" /> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E1"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E2"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E3"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E4"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E5"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B1"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B2"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B3"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.833" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B4"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B5"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:1.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <!-- The ElementOpacity on FormsProgressBar is used in place of Opacity so that the user may specify + a particular value they might wish to use, and also prevents unintended interactions between + Element.Opacity and Control.Opacity. --> + <DoubleAnimation Storyboard.TargetName="EllipseGrid" + Storyboard.TargetProperty="Opacity" + To="{Binding ElementOpacity, RelativeSource={RelativeSource TemplatedParent}}" + Duration="0" /> + <!-- Both FadeOutThemeAnimation and a DoubleAnimation on Opacity are necessary + here. The FadeOutThemeAnimation is necessary in the Indeterminate state so + that we can do a FadeInThemeAnimation when transitioning back to the + Determinate state. The DoubleAnimation on Opacity is necessary to hide the + DeterminateRoot immediately so that it does not slowly fade out during each + iteration of the Indeterminate state animation. --> + <FadeOutThemeAnimation TargetName="DeterminateRoot" /> + <DoubleAnimation Storyboard.TargetName="DeterminateRoot" + Storyboard.TargetProperty="Opacity" + To="0" + Duration="0" /> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E1"> + <EasingDoubleKeyFrame KeyTime="0" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E2"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E3"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E4"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E5"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Error"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ProgressBarIndicator"> + <DiscreteObjectKeyFrame KeyTime="0" Value="0" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Paused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundAccentBrush}" /> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimation Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Opacity" + To="{ThemeResource ProgressBarIndicatorPauseOpacity}" + Duration="0:0:0.25" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="EllipseGrid" + Opacity="0"> + <Grid.RenderTransform> + <TranslateTransform /> + </Grid.RenderTransform> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + <Border x:Name="B1" + Grid.Column="8" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E1" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="7" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B2" + Grid.Column="6" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E2" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="5" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B3" + Grid.Column="4" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E3" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="3" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B4" + Grid.Column="2" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E4" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="1" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B5" + Grid.Column="0" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E5" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + </Grid> + <Border x:Name="DeterminateRoot" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <Rectangle x:Name="ProgressBarIndicator" + Margin="{TemplateBinding Padding}" + Fill="{TemplateBinding Foreground}" + HorizontalAlignment="Left" /> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Xamarin.Forms.Platform.UAP/Resources.xaml b/Xamarin.Forms.Platform.UAP/Resources.xaml index 1ec6be7c..16500459 100644 --- a/Xamarin.Forms.Platform.UAP/Resources.xaml +++ b/Xamarin.Forms.Platform.UAP/Resources.xaml @@ -7,6 +7,7 @@ <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="FormsCommandBarStyle.xaml" /> <ResourceDictionary Source="PageControlStyle.xaml" /> + <ResourceDictionary Source="FormsProgressBarStyle.xaml" /> <ResourceDictionary Source="FormsTextBoxStyle.xaml" /> <ResourceDictionary Source="AutoSuggestStyle.xaml" /> <ResourceDictionary Source="MasterDetailControlStyle.xaml" /> diff --git a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj index b1ae854a..fe6b1d1e 100644 --- a/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj +++ b/Xamarin.Forms.Platform.UAP/Xamarin.Forms.Platform.UAP.csproj @@ -134,6 +134,9 @@ <Compile Include="..\Xamarin.Forms.Platform.WinRT\BrushHelpers.cs"> <Link>BrushHelpers.cs</Link> </Compile> + <Compile Include="..\Xamarin.Forms.Platform.WinRT\FormsProgressBar.cs"> + <Link>FormsProgressBar.cs</Link> + </Compile> <Compile Include="..\Xamarin.Forms.Platform.WinRT\FormsTextBox.cs"> <Link>FormsTextBox.cs</Link> </Compile> @@ -442,6 +445,10 @@ <Generator>MSBuild:Compile</Generator> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Page> + <Page Include="FormsProgressBarStyle.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="FormsTextBoxStyle.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/Xamarin.Forms.Platform.WinRT.Phone/FormsProgressBarStyle.xaml b/Xamarin.Forms.Platform.WinRT.Phone/FormsProgressBarStyle.xaml new file mode 100644 index 00000000..fec83e63 --- /dev/null +++ b/Xamarin.Forms.Platform.WinRT.Phone/FormsProgressBarStyle.xaml @@ -0,0 +1,325 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:winRt="using:Xamarin.Forms.Platform.WinRT"> + + <!-- Default style for Windows.UI.Xaml.Controls.ProgressBar --> + <Style x:Key="FormsProgressBarStyle" TargetType="winRt:FormsProgressBar"> + <Setter Property="Foreground" Value="{ThemeResource ProgressBarForegroundThemeBrush}" /> + <Setter Property="Background" Value="{ThemeResource ProgressBarBackgroundThemeBrush}" /> + <Setter Property="BorderBrush" Value="{ThemeResource ProgressBarBorderThemeBrush}" /> + <Setter Property="BorderThickness" Value="{ThemeResource ProgressBarBorderThemeThickness}" /> + <Setter Property="Maximum" Value="100" /> + <Setter Property="MinHeight" Value="{ThemeResource ProgressBarThemeMinHeight}" /> + <Setter Property="IsTabStop" Value="False" /> + <Setter Property="VerticalAlignment" Value="Center" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ProgressBar"> + <Grid> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualStateGroup.Transitions> + <VisualTransition From="Updating" To="Determinate"> + <Storyboard> + <RepositionThemeAnimation TargetName="ProgressBarIndicator" FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.IndicatorLengthDelta}" /> + </Storyboard> + </VisualTransition> + <VisualTransition From="Paused" To="Determinate"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0:0:0.25" /> + </Storyboard> + </VisualTransition> + <VisualTransition From="Indeterminate"> + <Storyboard> + <FadeInThemeAnimation TargetName="EllipseGrid" /> + </Storyboard> + </VisualTransition> + </VisualStateGroup.Transitions> + <VisualState x:Name="Determinate" /> + <VisualState x:Name="Updating" /> + <VisualState x:Name="Indeterminate"> + <Storyboard RepeatBehavior="Forever"> + <DoubleAnimation Storyboard.TargetName="EllipseGrid" + Duration="0:0:3.917" + Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" + From="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContainerAnimationStartPosition}" + To="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContainerAnimationEndPosition}" /> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E1"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E2"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E3"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E4"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E5"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B1"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B2"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B3"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.833" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B4"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B5"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:1.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <!-- The ElementOpacity on FormsProgressBar is used in place of Opacity so that the user may specify + a particular value they might wish to use, and also prevents unintended interactions between + Element.Opacity and Control.Opacity. --> + <DoubleAnimation Storyboard.TargetName="EllipseGrid" + Storyboard.TargetProperty="Opacity" + To="{Binding ElementOpacity, RelativeSource={RelativeSource TemplatedParent}}" + Duration="0" /> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E1" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E2" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E3" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E4" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E5" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <!-- Both FadeOutThemeAnimation and a DoubleAnimation on Opacity are necessary + here. The FadeOutThemeAnimation is necessary in the Indeterminate state so + that we can do a FadeInThemeAnimation when transitioning back to the + Determinate state. The DoubleAnimation on Opacity is necessary to hide the + DeterminateRoot immediately so that it does not slowly fade out during each + iteration of the Indeterminate state animation. --> + <FadeOutThemeAnimation TargetName="DeterminateRoot" /> + <DoubleAnimation Storyboard.TargetName="DeterminateRoot" + Storyboard.TargetProperty="Opacity" + To="0" + Duration="0" /> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E1"> + <EasingDoubleKeyFrame KeyTime="0" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E2"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E3"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E4"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E5"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Error"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ProgressBarIndicator"> + <DiscreteObjectKeyFrame KeyTime="0" Value="0" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Paused"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Opacity" + To="0.5" + Duration="0:0:0.25" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="EllipseGrid" + Opacity="0"> + <Grid.RenderTransform> + <TranslateTransform /> + </Grid.RenderTransform> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + <Border x:Name="B1" + Grid.Column="8" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E1" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="7" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B2" + Grid.Column="6" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E2" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="5" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B3" + Grid.Column="4" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E3" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="3" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B4" + Grid.Column="2" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E4" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="1" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B5" + Grid.Column="0" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E5" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + </Grid> + <Border x:Name="DeterminateRoot" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <Rectangle x:Name="ProgressBarIndicator" + Margin="{TemplateBinding Padding}" + Fill="{TemplateBinding Foreground}" + HorizontalAlignment="Left" /> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml b/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml index f8536369..fa3bbd24 100644 --- a/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml +++ b/Xamarin.Forms.Platform.WinRT.Phone/PhoneResources.xaml @@ -6,6 +6,7 @@ <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources.xaml" /> <ResourceDictionary Source="FormsTextBoxStyle.xaml" /> + <ResourceDictionary Source="FormsProgressBarStyle.xaml" /> </ResourceDictionary.MergedDictionaries> <!-- Fixes button sizing, including background outside the border --> diff --git a/Xamarin.Forms.Platform.WinRT.Phone/Xamarin.Forms.Platform.WinRT.Phone.csproj b/Xamarin.Forms.Platform.WinRT.Phone/Xamarin.Forms.Platform.WinRT.Phone.csproj index fcc75b71..efe45eb9 100644 --- a/Xamarin.Forms.Platform.WinRT.Phone/Xamarin.Forms.Platform.WinRT.Phone.csproj +++ b/Xamarin.Forms.Platform.WinRT.Phone/Xamarin.Forms.Platform.WinRT.Phone.csproj @@ -118,6 +118,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="FormsProgressBarStyle.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="FormsTextBoxStyle.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/FormsProgressBarStyle.xaml b/Xamarin.Forms.Platform.WinRT.Tablet/FormsProgressBarStyle.xaml new file mode 100644 index 00000000..fec83e63 --- /dev/null +++ b/Xamarin.Forms.Platform.WinRT.Tablet/FormsProgressBarStyle.xaml @@ -0,0 +1,325 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:winRt="using:Xamarin.Forms.Platform.WinRT"> + + <!-- Default style for Windows.UI.Xaml.Controls.ProgressBar --> + <Style x:Key="FormsProgressBarStyle" TargetType="winRt:FormsProgressBar"> + <Setter Property="Foreground" Value="{ThemeResource ProgressBarForegroundThemeBrush}" /> + <Setter Property="Background" Value="{ThemeResource ProgressBarBackgroundThemeBrush}" /> + <Setter Property="BorderBrush" Value="{ThemeResource ProgressBarBorderThemeBrush}" /> + <Setter Property="BorderThickness" Value="{ThemeResource ProgressBarBorderThemeThickness}" /> + <Setter Property="Maximum" Value="100" /> + <Setter Property="MinHeight" Value="{ThemeResource ProgressBarThemeMinHeight}" /> + <Setter Property="IsTabStop" Value="False" /> + <Setter Property="VerticalAlignment" Value="Center" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ProgressBar"> + <Grid> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualStateGroup.Transitions> + <VisualTransition From="Updating" To="Determinate"> + <Storyboard> + <RepositionThemeAnimation TargetName="ProgressBarIndicator" FromHorizontalOffset="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.IndicatorLengthDelta}" /> + </Storyboard> + </VisualTransition> + <VisualTransition From="Paused" To="Determinate"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0:0:0.25" /> + </Storyboard> + </VisualTransition> + <VisualTransition From="Indeterminate"> + <Storyboard> + <FadeInThemeAnimation TargetName="EllipseGrid" /> + </Storyboard> + </VisualTransition> + </VisualStateGroup.Transitions> + <VisualState x:Name="Determinate" /> + <VisualState x:Name="Updating" /> + <VisualState x:Name="Indeterminate"> + <Storyboard RepeatBehavior="Forever"> + <DoubleAnimation Storyboard.TargetName="EllipseGrid" + Duration="0:0:3.917" + Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" + From="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContainerAnimationStartPosition}" + To="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.ContainerAnimationEndPosition}" /> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E1"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E2"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.167" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E3"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.333" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E4"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.5" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="E5"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <SplineDoubleKeyFrame KeyTime="0:0:1.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" KeySpline="0.4,0,0.6,1" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationWellPosition}" /> + <SplineDoubleKeyFrame KeyTime="0:0:3.667" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseAnimationEndPosition}" KeySpline="0.4,0,0.6,1" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B1"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B2"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B3"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.833" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.333" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B4"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="B5"> + <EasingDoubleKeyFrame KeyTime="0" Value="-50" /> + <EasingDoubleKeyFrame KeyTime="0:0:1.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:2.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="100" /> + </DoubleAnimationUsingKeyFrames> + <!-- The ElementOpacity on FormsProgressBar is used in place of Opacity so that the user may specify + a particular value they might wish to use, and also prevents unintended interactions between + Element.Opacity and Control.Opacity. --> + <DoubleAnimation Storyboard.TargetName="EllipseGrid" + Storyboard.TargetProperty="Opacity" + To="{Binding ElementOpacity, RelativeSource={RelativeSource TemplatedParent}}" + Duration="0" /> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E1" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E2" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E3" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E4" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="E5" + Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ProgressBarIndeterminateForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <!-- Both FadeOutThemeAnimation and a DoubleAnimation on Opacity are necessary + here. The FadeOutThemeAnimation is necessary in the Indeterminate state so + that we can do a FadeInThemeAnimation when transitioning back to the + Determinate state. The DoubleAnimation on Opacity is necessary to hide the + DeterminateRoot immediately so that it does not slowly fade out during each + iteration of the Indeterminate state animation. --> + <FadeOutThemeAnimation TargetName="DeterminateRoot" /> + <DoubleAnimation Storyboard.TargetName="DeterminateRoot" + Storyboard.TargetProperty="Opacity" + To="0" + Duration="0" /> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E1"> + <EasingDoubleKeyFrame KeyTime="0" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E2"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.167" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.167" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E3"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.333" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.333" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E4"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.5" Value="0" /> + </DoubleAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="E5"> + <EasingDoubleKeyFrame KeyTime="0" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="0" /> + <EasingDoubleKeyFrame KeyTime="0:0:0.667" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="1" /> + <EasingDoubleKeyFrame KeyTime="0:0:3.667" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Error"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ProgressBarIndicator"> + <DiscreteObjectKeyFrame KeyTime="0" Value="0" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Paused"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="ProgressBarIndicator" + Storyboard.TargetProperty="Opacity" + To="0.5" + Duration="0:0:0.25" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="EllipseGrid" + Opacity="0"> + <Grid.RenderTransform> + <TranslateTransform /> + </Grid.RenderTransform> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + <Border x:Name="B1" + Grid.Column="8" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E1" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="7" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B2" + Grid.Column="6" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E2" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="5" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B3" + Grid.Column="4" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E3" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="3" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B4" + Grid.Column="2" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E4" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + <Rectangle Grid.Column="1" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseOffset}" /> + <Border x:Name="B5" + Grid.Column="0" + RenderTransformOrigin="0.5,0.5"> + <Border.RenderTransform> + <TranslateTransform /> + </Border.RenderTransform> + <Ellipse x:Name="E5" + Fill="{TemplateBinding Foreground}" + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.EllipseDiameter}" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <TranslateTransform /> + </Ellipse.RenderTransform> + </Ellipse> + </Border> + </Grid> + <Border x:Name="DeterminateRoot" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <Rectangle x:Name="ProgressBarIndicator" + Margin="{TemplateBinding Padding}" + Fill="{TemplateBinding Foreground}" + HorizontalAlignment="Left" /> + </Border> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml b/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml index c782d5d9..43debde6 100644 --- a/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml +++ b/Xamarin.Forms.Platform.WinRT.Tablet/TabletResources.xaml @@ -6,6 +6,7 @@ <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources.xaml" /> <ResourceDictionary Source="FormsTextBoxStyle.xaml" /> + <ResourceDictionary Source="FormsProgressBarStyle.xaml" /> </ResourceDictionary.MergedDictionaries> <SolidColorBrush x:Key="TabButtonPointerOverBackgroundBrush" Color="#44888888" /> diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/Xamarin.Forms.Platform.WinRT.Tablet.csproj b/Xamarin.Forms.Platform.WinRT.Tablet/Xamarin.Forms.Platform.WinRT.Tablet.csproj index 3712ad5f..d4ac3482 100644 --- a/Xamarin.Forms.Platform.WinRT.Tablet/Xamarin.Forms.Platform.WinRT.Tablet.csproj +++ b/Xamarin.Forms.Platform.WinRT.Tablet/Xamarin.Forms.Platform.WinRT.Tablet.csproj @@ -141,6 +141,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="FormsProgressBarStyle.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="FormsTextBoxStyle.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> 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" /> |