mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-02 11:57:37 +08:00
commit
e2740feb50
@ -1,5 +1,105 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: NumericUpDown 数值选择控件
|
||||
---
|
||||
|
||||
建设中
|
||||
NumericUpDown 控件看起来像一对用户可以单击来调整值的箭头按钮和TextBox的组合,该控件显示并设置数值(Value)。 用户可以通过单击向上和向下箭头,或通过在控件的TextBox部分中键入一个数字来改变Value。
|
||||
|
||||
``` CS
|
||||
[TemplatePart(Name = ElementTextBox, Type = typeof(DatePickerTextBox))]
|
||||
public class DatePicker : System.Windows.Controls.DatePicker, IDataInput
|
||||
```
|
||||
|
||||
# 创建NumericUpDown并设置Value
|
||||
|
||||
``` XML
|
||||
<hc:NumericUpDown Value="100"/>
|
||||
```
|
||||
|
||||
``` CS
|
||||
var numericUpDown = new NumericUpDown();
|
||||
numericUpDown.Value = 100;
|
||||
```
|
||||
|
||||
生成的NumericUpDown如下图所示:
|
||||
|
||||
![NumericUpDown](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/extend_controls/NumericUpDown_1.png)
|
||||
|
||||
|
||||
# 设置DecimalPlaces
|
||||
|
||||
如果需要改变Value显示的小数位数,可以改变DecimalPlaces。DecimalPlaces是一个 **int?** 类型,当它为null时不限制显示的小数位数,否则显示的小数位数为DecimalPlaces的Value。
|
||||
|
||||
``` XML
|
||||
<hc:NumericUpDown DecimalPlaces="2" Value="100.12345"/>
|
||||
```
|
||||
|
||||
``` CS
|
||||
numericUpDown.Value = 10.12345;
|
||||
numericUpDown.DecimalPlaces = 2;
|
||||
```
|
||||
|
||||
![NumericUpDown](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/extend_controls/NumericUpDown_2.png)
|
||||
|
||||
# 设置Increment
|
||||
|
||||
可以通设置Increment改变单击一下按钮时增加或减少的数量。
|
||||
|
||||
``` XML
|
||||
<hc:NumericUpDown Value="100" Increment="10"/>
|
||||
```
|
||||
|
||||
``` CS
|
||||
numericUpDown.Increment = 10;
|
||||
```
|
||||
|
||||
# 设置上限和下限
|
||||
|
||||
可以通设置Maximum和Minimum限制Value的上限和下限。
|
||||
|
||||
``` XML
|
||||
<hc:NumericUpDown Maximum="500" Minimum="10"/>
|
||||
```
|
||||
|
||||
``` CS
|
||||
numericUpDown.Minimum = 10;
|
||||
numericUpDown.Maximum = 1000;
|
||||
```
|
||||
|
||||
# 设置标题和占位符文本
|
||||
|
||||
你可以将 Header(标题)和 Placeholder(占位符)添加到NumericUpDown,以向用户指示其用途。要使用这两个附加属性,需要先应用 **NumericUpDownPlus** 样式。
|
||||
|
||||
``` XML
|
||||
<hc:NumericUpDown hc:InfoElement.Placeholder="{x:Static langs:Lang.PlsEnterContent}"
|
||||
hc:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}"
|
||||
Style="{StaticResource NumericUpDownExtend}" />
|
||||
```
|
||||
|
||||
![NumericUpDown](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/extend_controls/NumericUpDown_3.png)
|
||||
|
||||
# 属性
|
||||
|
||||
| 属性 | 描述 |
|
||||
| ---------------- | ------------------ |
|
||||
| Value | 获取或设置当前值 |
|
||||
| Maximum | 获取或设置最大允许值 |
|
||||
| Minimum | 获取或设置最小允许值 |
|
||||
| Increment | 获取或设置单击向上或向下按钮时,数字显示框(也称作 up-down 控件)递增或递减的值。 |
|
||||
| DecimalPlaces |获取或设置NumericUpDown中要显示的十进制位数。 此属性不会影响 Value 属性。 |
|
||||
| VerifyFunc | 获取或设置数据验证委托 |
|
||||
| IsError | 获取或设置数据是否错误 |
|
||||
| ErrorStr | 获取或设置错误提示 |
|
||||
| TextType | 获取或设置文本类型 |
|
||||
| ShowClearButton | 获取或设置是否显示清除按钮 |
|
||||
|
||||
# 方法
|
||||
|
||||
| 方法 | 描述 |
|
||||
| ---------------- | ------------------ |
|
||||
| VerifyData() | 验证数据 |
|
||||
|
||||
# 事件
|
||||
|
||||
| 事件 | 描述 |
|
||||
| ---------------- | ------------------ |
|
||||
| ValueChanged | 在以某种方式更改 Value 属性后发生。 |
|
||||
|
@ -1,5 +1,115 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: RadioButton 单选按钮
|
||||
---
|
||||
|
||||
建设中
|
||||
# RadioButtonBaseStyle
|
||||
|
||||
单选按钮默认样式,不推荐直接使用,应该始终被其它样式以BasedOn的方式使用。
|
||||
|
||||
案例:
|
||||
|
||||
```xml
|
||||
<StackPanel>
|
||||
<RadioButton Content="默认样式"/>
|
||||
<RadioButton Margin="0,16,0,0" Content="不可编辑" IsChecked="True" IsEnabled="False"/>
|
||||
<RadioButton Margin="0,16,0,0" Content="默认样式"/>
|
||||
<RadioButton Margin="0,16,0,0" Content="不可编辑" IsEnabled="False"/>
|
||||
</StackPanel>
|
||||
```
|
||||
|
||||
效果:
|
||||
|
||||
![RadioButton.DefaultStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/RadioButton.DefaultStyle.png)
|
||||
|
||||
# RadioButtonIcon:RadioButtonBaseStyle
|
||||
|
||||
带图标样式,可只显示图标也可图文显示
|
||||
|
||||
案例:
|
||||
|
||||
```xml
|
||||
<UniformGrid Margin="22,0,0,0" Rows="2" Columns="2">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon}" Content="RadioButtonIcon"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="RadioButtonIcon" IsChecked="True"/>
|
||||
<RadioButton Margin="10,0,0,0" BorderThickness="1" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" Style="{StaticResource RadioButtonIcon}" Content="RadioButtonIcon"/>
|
||||
<RadioButton Margin="10,0,0,0" BorderThickness="1" Style="{StaticResource RadioButtonIcon}" Content="RadioButtonIcon"/>
|
||||
</UniformGrid>
|
||||
```
|
||||
|
||||
效果:
|
||||
|
||||
![RadioButton.IconStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/RadioButton.IconStyle.png)
|
||||
|
||||
# RadioGroupItemBaseStyle
|
||||
|
||||
`ButtonGroup`控件中的子集`RadioButton`样式基类,不建议直接使用,常作为`ButtonGroup`中`Item`样式基类,同时与`ButtonGroup`控件配套使用
|
||||
|
||||
案例:
|
||||
|
||||
```xml
|
||||
<!--内部Item样式为ButtonGroup控件自动附加-默认为水平方向item样式-->
|
||||
<hc:ButtonGroup Margin="0,32,0,0">
|
||||
<RadioButton Content="RadioButton" IsChecked="True"/>
|
||||
<RadioButton Content="RadioButton"/>
|
||||
<RadioButton IsEnabled="False" Content="RadioButton"/>
|
||||
<RadioButton Content="RadioButton"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="0,16,0,0" Style="{StaticResource ButtonGroupSolid}">
|
||||
<RadioButton Content="RadioButton"/>
|
||||
<RadioButton Content="RadioButton"/>
|
||||
<RadioButton IsEnabled="False" Content="RadioButton"/>
|
||||
<RadioButton Content="RadioButton" IsChecked="True"/>
|
||||
</hc:ButtonGroup>
|
||||
```
|
||||
|
||||
效果:
|
||||
|
||||
![RadioButton.RadioButtonItemDefaultStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/RadioButton.RadioButtonItemDefaultStyle.png)
|
||||
|
||||
# RadioGroup关联样式
|
||||
|
||||
| 样式Key | 用途 | 基类样式 |
|
||||
| ----------------------------- | ------------------------------------ | ----------------------- |
|
||||
| RadioGroupItemDefault | RadioGroupItem默认样式 | RadioGroupItemBaseStyle |
|
||||
| RadioGroupItemHorizontalFirst | RadioGroupItem水平头样式(从左至右) | RadioGroupItemBaseStyle |
|
||||
| RadioGroupItemHorizontalLast | RadioGroupItem水平尾样式(从左至右) | RadioGroupItemBaseStyle |
|
||||
| RadioGroupItemSingle | RadioGroupItem单项样式 | RadioGroupItemBaseStyle |
|
||||
| RadioGroupItemVerticalFirst | RadioGroupItem垂直头样式(从上至下) | RadioGroupItemBaseStyle |
|
||||
| RadioGroupItemVerticalLast | RadioGroupItem垂直尾样式(从上至下) | RadioGroupItemBaseStyle |
|
||||
|
||||
案例:
|
||||
|
||||
单个`RadioButton`样式:
|
||||
|
||||
```xml
|
||||
<RadioButton Style="{DynamicResource RadioGroupItemSingle}"
|
||||
Margin="0,16,8,0"
|
||||
Content="RadioGroupItemSingle"></RadioButton>
|
||||
```
|
||||
|
||||
效果:
|
||||
|
||||
![RadioButton.RadioButtonItemSingleStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/RadioButton.RadioButtonItemSingleStyle.png)
|
||||
|
||||
多个`RadioButton`垂直样式:
|
||||
|
||||
```xml
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<hc:ButtonGroup Margin="0,16,8,0" Orientation="Vertical">
|
||||
<RadioButton Content="RadioButton" IsChecked="True"/>
|
||||
<RadioButton Content="RadioButton"/>
|
||||
<RadioButton IsEnabled="False" Content="RadioButton"/>
|
||||
<RadioButton Content="RadioButton"/>
|
||||
</hc:ButtonGroup>
|
||||
<hc:ButtonGroup Margin="8,16,0,0" Orientation="Vertical" Style="{StaticResource ButtonGroupSolid}">
|
||||
<RadioButton Content="RadioButton"/>
|
||||
<RadioButton Content="RadioButton"/>
|
||||
<RadioButton IsEnabled="False" Content="RadioButton"/>
|
||||
<RadioButton Content="RadioButton" IsChecked="True"/>
|
||||
</hc:ButtonGroup>
|
||||
</StackPanel>
|
||||
```
|
||||
|
||||
效果:
|
||||
|
||||
![RadioButton.RadioButtonItemVerticalStyle](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Doc/native_controls/RadioButton.RadioButtonItemVerticalStyle.png)
|
@ -73,7 +73,7 @@
|
||||
<ScrollViewer Grid.Column="1" Grid.Row="0">
|
||||
<TextBlock Margin="10,39,10,10" Text="{TemplateBinding Message}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
|
||||
|
@ -74,7 +74,7 @@
|
||||
<ScrollViewer Grid.Column="1" Grid.Row="0">
|
||||
<TextBlock Margin="10,39,10,10" Text="{TemplateBinding Message}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
|
||||
|
@ -73,7 +73,7 @@
|
||||
<ScrollViewer Grid.Column="1" Grid.Row="0">
|
||||
<TextBlock Margin="10,39,10,10" Text="{TemplateBinding Message}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</ScrollViewer>
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
|
||||
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
|
||||
|
@ -24,7 +24,7 @@
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<DockPanel>
|
||||
<Button Command="{Binding OpenOverviewCmd}" DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="4,4,4,0" Content="{x:Static langs:Lang.Overview}"/>
|
||||
<Button Command="{Binding OpenOverviewCmd}" DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="4" Content="{x:Static langs:Lang.Overview}"/>
|
||||
<TabControl SelectionChanged="TabControl_OnSelectionChanged" ItemsSource="{Binding DemoInfoList}" Style="{StaticResource TabControlInLine}" Background="Transparent" SelectedIndex="0">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<ProgressBar Style="{StaticResource ProgressBarSuccess}" Margin="0,0,0,10" Value="40"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarInfo}" Margin="0,0,0,10" Value="60"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarWarning}" Margin="0,0,0,10" Value="80"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarDanger}" Margin="0,0,0,10" Value="100" Maximum="200"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarDanger}" Margin="0,0,0,10" Value="100" Maximum="200" IsIndeterminate="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="10,0,0,0" Width="200" HorizontalAlignment="Left">
|
||||
<TextBlock Padding="0,2,0,3" Style="{StaticResource TextBlockDefault}" Text="ProgressbarPrimary" HorizontalAlignment="Left"/>
|
||||
@ -27,8 +27,8 @@
|
||||
<ProgressBar Style="{StaticResource ProgressBarSuccessStripe}" Margin="0,0,0,10" Value="60" Maximum="200" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarInfoStripe}" Margin="0,0,0,10" Value="50" Maximum="200" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarWarningStripe}" Margin="0,0,0,10" Value="180" Maximum="200" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarDangerStripe}" Margin="0,0,0,10" Value="110" Maximum="200" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarFlat}" Margin="0,8,0,10" Value="110" Maximum="200" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarDangerStripe}" Margin="0,0,0,10" IsIndeterminate="True" Maximum="200" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarFlat}" Margin="0,8,0,10" Value="110" Maximum="200" IsIndeterminate="True"/>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="10,0,0,0" Width="200" HorizontalAlignment="Left">
|
||||
<TextBlock Padding="0,2,0,3" Style="{StaticResource TextBlockDefault}" Text="ProgressBarPrimaryStripe" HorizontalAlignment="Left"/>
|
||||
@ -39,6 +39,20 @@
|
||||
<TextBlock Padding="0,12,0,3" Style="{StaticResource TextBlockDefault}" Text="ProgressBarPlayer" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Height="200">
|
||||
<ProgressBar Value="20" Margin="0,0,10,0" Orientation="Vertical" Width="20"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarSuccess}" Margin="0,0,10,0" Value="40" Orientation="Vertical" Width="20"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarInfo}" Margin="0,0,10,0" Value="60" Orientation="Vertical" Width="20"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarWarning}" Margin="0,0,10,0" Value="80" Orientation="Vertical" Width="20"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarDanger}" Margin="0,0,10,0" Value="100" Maximum="200" IsIndeterminate="True" Width="20" Orientation="Vertical"/>
|
||||
|
||||
<ProgressBar Style="{StaticResource ProgressBarPrimaryStripe}" Margin="10,0,10,0" Value="120" Maximum="200" Orientation="Vertical" Width="20" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarSuccessStripe}" Margin="0,0,10,0" Value="60" Maximum="200" Orientation="Vertical" Width="20" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarInfoStripe}" Margin="0,0,10,0" Value="50" Maximum="200" Orientation="Vertical" Width="20" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarWarningStripe}" Margin="0,0,10,0" Value="180" Maximum="200" Orientation="Vertical" Width="20" />
|
||||
<ProgressBar Style="{StaticResource ProgressBarDangerStripe}" Margin="0,0,10,0" IsIndeterminate="True" Maximum="200" Orientation="Vertical" Width="20"/>
|
||||
<ProgressBar Style="{StaticResource ProgressBarFlat}" Margin="0,0,10,0" Value="110" Maximum="200" IsIndeterminate="True" Orientation="Vertical" Width="4"/>
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
|
@ -9,7 +9,7 @@
|
||||
OtherButtonForeground="{DynamicResource ReverseTextBrush}"
|
||||
CloseButtonForeground="{DynamicResource ReverseTextBrush}"
|
||||
NonClientAreaBackground="{DynamicResource ToolBarBackground}"
|
||||
NonClientAreaHeight="69"
|
||||
NonClientAreaHeight="62"
|
||||
Background="{DynamicResource MainContentBackgroundBrush}"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ShowTitle="False"
|
||||
|
@ -196,13 +196,7 @@ namespace HandyControl.Controls
|
||||
ctl.Value = maximum;
|
||||
}
|
||||
|
||||
var result = num > maximum ? maximum : num;
|
||||
if (!ctl.DecimalPlaces.HasValue)
|
||||
{
|
||||
result = Math.Floor(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return num > maximum ? maximum : num;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,7 +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:HandyControl.Controls"
|
||||
xmlns:shapes="clr-namespace:HandyControl.Expression.Shapes">
|
||||
xmlns:shapes="clr-namespace:HandyControl.Expression.Shapes"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
@ -33,18 +34,58 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ProgressBar">
|
||||
<controls:SimplePanel x:Name="TemplateRoot">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
|
||||
<Rectangle x:Name="PART_Track"/>
|
||||
<controls:SimplePanel HorizontalAlignment="Left">
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="Animation" ClipToBounds="true" Background="{TemplateBinding Foreground}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="IsIndeterminate" RepeatBehavior="Forever">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
|
||||
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
|
||||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
|
||||
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
|
||||
</PointAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Border x:Name="TemplateRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<controls:SimplePanel>
|
||||
<Rectangle x:Name="PART_Track"/>
|
||||
<Border Style="{StaticResource BorderClip}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="PART_Indicator" HorizontalAlignment="Left">
|
||||
<controls:SimplePanel>
|
||||
<Border x:Name="Indicator" Background="{TemplateBinding Foreground}">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextIconBrush}" Text="{Binding Path=(controls:VisualElement.Text),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
</Border>
|
||||
<Rectangle x:Name="PART_GlowRect" Fill="{StaticResource ProgressBarIndicatorAnimatedFill}" HorizontalAlignment="Left" Margin="-100,0,0,0" Width="100"/>
|
||||
</Border>
|
||||
</Decorator>
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextIconBrush}" Text="{Binding Path=(controls:VisualElement.Text),RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||
<Rectangle x:Name="Animation" Visibility="Collapsed" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
|
||||
<Rectangle.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
</TransformGroup>
|
||||
</Rectangle.RenderTransform>
|
||||
</Rectangle>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
</controls:SimplePanel>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Orientation" Value="Vertical">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="LayoutTransform" TargetName="TemplateRoot">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-90"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<Trigger Property="IsIndeterminate" Value="true">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource IsIndeterminate}"/>
|
||||
</Trigger.EnterActions>
|
||||
<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
|
||||
<Setter Property="Visibility" TargetName="PART_GlowRect" Value="Collapsed"/>
|
||||
<Setter Property="Visibility" TargetName="Animation" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@ -70,11 +111,19 @@
|
||||
<controls:SimplePanel x:Name="TemplateRoot" SnapsToDevicePixels="true">
|
||||
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
|
||||
<Rectangle x:Name="PART_Track"/>
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="1">
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
|
||||
<Border x:Name="Indicator" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Foreground}"/>
|
||||
</Decorator>
|
||||
</controls:SimplePanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Orientation" Value="Vertical">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="LayoutTransform" TargetName="TemplateRoot">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-90"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
<EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="Indicator">
|
||||
<BeginStoryboard Storyboard="{StaticResource OnLoaded}"/>
|
||||
</EventTrigger>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/ProgressBarBaseStyle.xaml"/>
|
||||
@ -42,8 +43,8 @@
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
@ -72,8 +73,8 @@
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
@ -102,8 +103,8 @@
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
@ -132,8 +133,8 @@
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
@ -162,8 +163,8 @@
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0"/>
|
||||
<GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="0.5"/>
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
|
||||
<GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</GeometryDrawing.Brush>
|
||||
<GeometryDrawing.Geometry>
|
||||
@ -223,14 +224,43 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ProgressBar">
|
||||
<controls:SimplePanel x:Name="TemplateRoot" SnapsToDevicePixels="true">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="IsIndeterminate" RepeatBehavior="Forever">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
|
||||
<EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
|
||||
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
|
||||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
|
||||
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
|
||||
</PointAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<controls:SimplePanel x:Name="TemplateRoot" SnapsToDevicePixels="true" ClipToBounds="True">
|
||||
<Rectangle x:Name="PART_Track" Fill="{TemplateBinding Background}" StrokeThickness="0" Stroke="{TemplateBinding BorderBrush}"/>
|
||||
<Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
|
||||
<Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
|
||||
</Decorator>
|
||||
<Rectangle x:Name="Animation" Visibility="Collapsed" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
|
||||
<Rectangle.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
</TransformGroup>
|
||||
</Rectangle.RenderTransform>
|
||||
</Rectangle>
|
||||
</controls:SimplePanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsIndeterminate" Value="true">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource IsIndeterminate}"/>
|
||||
</Trigger.EnterActions>
|
||||
<Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
|
||||
<Setter Property="Visibility" TargetName="Animation" Value="Visible"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Orientation" Value="Vertical">
|
||||
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
||||
<Setter Property="LayoutTransform" TargetName="TemplateRoot">
|
||||
<Setter.Value>
|
||||
<RotateTransform Angle="-90"/>
|
||||
|
Loading…
Reference in New Issue
Block a user