整理代码
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||||
xmlns:converters="clr-namespace:Melskin.Converters"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:converters="clr-namespace:Melskin.Converters">
|
||||
|
||||
<Style TargetType="{x:Type controls:Spin}">
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
@@ -15,24 +15,24 @@
|
||||
<Grid>
|
||||
<!-- Content -->
|
||||
<Border
|
||||
x:Name="Content"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
x:Name="Content">
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
|
||||
</Border>
|
||||
<!-- IndicatorPanel -->
|
||||
<Grid
|
||||
x:Name="IndicatorPanel"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding Spinning, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}"
|
||||
x:Name="IndicatorPanel">
|
||||
Visibility="{Binding Spinning, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}">
|
||||
<Grid.RowDefinitions>
|
||||
<!-- Icon -->
|
||||
<RowDefinition />
|
||||
@@ -41,17 +41,17 @@
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Indicator -->
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Indicator}"
|
||||
x:Name="Indicator"
|
||||
Grid.RowSpan="2"
|
||||
Visibility="Hidden"
|
||||
x:Name="Indicator" />
|
||||
Content="{TemplateBinding Indicator}"
|
||||
Visibility="Hidden" />
|
||||
<!-- Dot -->
|
||||
<Grid
|
||||
x:Name="Dot"
|
||||
Grid.RowSpan="2"
|
||||
Height="{Binding Width, Mode=OneWay, RelativeSource={RelativeSource Self}}"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
Width="20"
|
||||
x:Name="Dot">
|
||||
Height="{Binding Width, Mode=OneWay, RelativeSource={RelativeSource Self}}"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<Grid.RenderTransform>
|
||||
<RotateTransform />
|
||||
</Grid.RenderTransform>
|
||||
@@ -69,40 +69,40 @@
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Ellipse
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
x:Name="Dot1"
|
||||
Width="9"
|
||||
x:Name="Dot1" />
|
||||
<Ellipse
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Width="{Binding Width, Mode=OneWay, ElementName=Dot1}"
|
||||
x:Name="Dot2" />
|
||||
<Ellipse
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="{Binding Width, Mode=OneWay, ElementName=Dot1}"
|
||||
x:Name="Dot3" />
|
||||
VerticalAlignment="Top" />
|
||||
<Ellipse
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
x:Name="Dot2"
|
||||
Width="{Binding Width, Mode=OneWay, ElementName=Dot1}"
|
||||
x:Name="Dot4" />
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top" />
|
||||
<Ellipse
|
||||
x:Name="Dot3"
|
||||
Width="{Binding Width, Mode=OneWay, ElementName=Dot1}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Bottom" />
|
||||
<Ellipse
|
||||
x:Name="Dot4"
|
||||
Width="{Binding Width, Mode=OneWay, ElementName=Dot1}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Tip}"
|
||||
x:Name="LoadingText"
|
||||
Grid.Row="1"
|
||||
x:Name="LoadingText" />
|
||||
Content="{TemplateBinding Tip}" />
|
||||
</Grid>
|
||||
<!-- Mask -->
|
||||
<Rectangle
|
||||
x:Name="Mask"
|
||||
Fill="Transparent"
|
||||
Visibility="Collapsed"
|
||||
x:Name="Mask" />
|
||||
Visibility="Collapsed" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="SpinStates">
|
||||
<VisualStateGroup.Transitions>
|
||||
<VisualTransition From="Spun" GeneratedDuration="0:0:0.2">
|
||||
<VisualTransition GeneratedDuration="0:0:0.2" From="Spun">
|
||||
<Storyboard>
|
||||
<!-- Content -->
|
||||
<DoubleAnimation Storyboard.TargetName="Content" Storyboard.TargetProperty="Opacity" />
|
||||
@@ -113,53 +113,53 @@
|
||||
<Storyboard>
|
||||
<!-- Content -->
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.2"
|
||||
Storyboard.TargetName="Content"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.5" />
|
||||
To="0.5"
|
||||
Duration="0:0:0.2" />
|
||||
<!-- Dot -->
|
||||
<DoubleAnimation
|
||||
Duration="0:0:1.2"
|
||||
From="45"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetName="Dot"
|
||||
Storyboard.TargetProperty="RenderTransform.Angle"
|
||||
To="405" />
|
||||
From="45"
|
||||
To="405"
|
||||
Duration="0:0:1.2" />
|
||||
<DoubleAnimation
|
||||
AutoReverse="True"
|
||||
Duration="0:0:1"
|
||||
From="0.3"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetName="Dot1"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1" />
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:1" />
|
||||
<DoubleAnimation
|
||||
AutoReverse="True"
|
||||
BeginTime="0:0:0.4"
|
||||
Duration="0:0:1"
|
||||
From="0.3"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetName="Dot2"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1" />
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:1" />
|
||||
<DoubleAnimation
|
||||
AutoReverse="True"
|
||||
BeginTime="0:0:0.8"
|
||||
Duration="0:0:1"
|
||||
From="0.3"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetName="Dot3"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1" />
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:1" />
|
||||
<DoubleAnimation
|
||||
AutoReverse="True"
|
||||
BeginTime="0:0:1.2"
|
||||
Duration="0:0:1"
|
||||
From="0.3"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetName="Dot4"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1" />
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:1" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Unspun" />
|
||||
@@ -177,8 +177,8 @@
|
||||
</Trigger>-->
|
||||
<!-- Spun State -->
|
||||
<Trigger Property="Spinning" Value="True">
|
||||
<Setter Property="Visibility" TargetName="Mask" Value="Visible" />
|
||||
<Setter Property="Effect" TargetName="Content">
|
||||
<Setter TargetName="Mask" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="Content" Property="Effect">
|
||||
<Setter.Value>
|
||||
<BlurEffect Radius="2" />
|
||||
</Setter.Value>
|
||||
@@ -186,18 +186,18 @@
|
||||
</Trigger>
|
||||
<!-- With Loading Text -->
|
||||
<DataTrigger Binding="{Binding Tip, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
||||
<Setter Property="Grid.RowSpan" TargetName="Dot" Value="1" />
|
||||
<Setter Property="Grid.RowSpan" TargetName="Indicator" Value="1" />
|
||||
<Setter Property="Margin" TargetName="LoadingText" Value="0,8,0,0" />
|
||||
<Setter TargetName="Dot" Property="Grid.RowSpan" Value="1" />
|
||||
<Setter TargetName="Indicator" Property="Grid.RowSpan" Value="1" />
|
||||
<Setter TargetName="LoadingText" Property="Margin" Value="0,8,0,0" />
|
||||
</DataTrigger>
|
||||
<!-- Nested Loading -->
|
||||
<DataTrigger Binding="{Binding Content, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
||||
<Setter Property="HorizontalAlignment" TargetName="IndicatorPanel" Value="Center" />
|
||||
<Setter TargetName="IndicatorPanel" Property="HorizontalAlignment" Value="Center" />
|
||||
</DataTrigger>
|
||||
<!-- With Indicator -->
|
||||
<DataTrigger Binding="{Binding Indicator, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
||||
<Setter Property="Visibility" TargetName="Dot" Value="Collapsed" />
|
||||
<Setter Property="Visibility" TargetName="Indicator" Value="Visible" />
|
||||
<Setter TargetName="Dot" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="Indicator" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
Reference in New Issue
Block a user