update to v1.2.1

This commit is contained in:
NaBian committed 2018-09-11 12:00:52 +08:00
1 parent f9475c318c
commit be950fac36
75 files changed
+2810 -288

No files matched your search

+10
View File
@@ -1,3 +1,13 @@
2018.09.04 Version 1.2.1
* new controls
- add TabControl
- add ContextMenuButton
- add ContextMenuToggleButton
* other
- update HandyControlDemo UI
- Localization
2018.09.04 Version 1.2.0
* new controls
- add Growl
@@ -0,0 +1,23 @@
using System.Windows.Controls;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
/// <summary>
/// 带上下文菜单的按钮
/// </summary>
public class ContextMenuButton : Button
{
public ContextMenu Menu { get; set; }
protected override void OnClick()
{
base.OnClick();
if (Menu != null)
{
Menu.PlacementTarget = this;
Menu.IsOpen = true;
}
}
}
}
@@ -0,0 +1,31 @@
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
/// <summary>
/// 带上下文菜单的切换按钮
/// </summary>
public class ContextMenuToggleButton : ToggleButton
{
public ContextMenu Menu { get; set; }
protected override void OnClick()
{
base.OnClick();
if (Menu != null)
{
if (IsChecked == true)
{
Menu.PlacementTarget = this;
Menu.IsOpen = true;
}
else
{
Menu.IsOpen = false;
}
}
}
}
}
+3 -2
View File
@@ -8,6 +8,7 @@
mc:Ignorable="d"
Name="UserControlMain"
Width="230"
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
UseLayoutRounding="True">
<Grid>
<Grid.RowDefinitions>
@@ -86,8 +87,8 @@
</Border>
<Border Grid.Row="3" BorderThickness="0,1,0,0" BorderBrush="{StaticResource BorderBrush}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Click="ButtonCancel_OnClick" Content="取消" Width="60" Margin="0,0,16,0"></Button>
<Button Click="ButtonSure_OnClick" Content="确定" Width="60" Style="{StaticResource ButtonPrimary}"></Button>
<Button Click="ButtonCancel_OnClick" Content="{x:Static langs:Lang.Cancel}" Width="80" Margin="0,0,16,0"></Button>
<Button Click="ButtonSure_OnClick" Content="{x:Static langs:Lang.Confirm}" Width="80" Style="{StaticResource ButtonPrimary}"></Button>
</StackPanel>
</Border>
</Grid>
+1 -5
View File
@@ -108,16 +108,12 @@ namespace HandyControl.Controls
GrowlPanel = panel;
var menuItem = new MenuItem
{
Header = "清空消息"
Header = Properties.Langs.Lang.Clear
};
menuItem.Click += (s, e) =>
{
foreach (var item in GrowlPanel.Children.OfType<Growl>())
{
//if (item.CloseAction != null)
//{
// item.Close();
//}
item.Close();
}
};
@@ -44,7 +44,7 @@
</Grid.RowDefinitions>
<StackPanel Name="StackPanelTitle" Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock Visibility="{Binding IsNeedly,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource Boolean2VisibilityConverter}}" VerticalAlignment="Center" Margin="0,0,6,0" Text="*" Foreground="{DynamicResource DangerBrush}"></TextBlock>
<TextBlock Style="{StaticResource TextBlockDefault}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource String2VisibilityFeConverter}}" Margin="0,0,10,0" Text="{Binding Title,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBlock>
<TextBlock Style="{StaticResource TextBlockDefault}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource String2VisibilityReConverter}}" Margin="0,0,10,0" Text="{Binding Title,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBlock>
</StackPanel>
<TextBlock Margin="4,0,0,1" Grid.Row="1" Name="TextBlockError" Grid.Column="1" VerticalAlignment="Bottom" FontSize="12" Foreground="{DynamicResource DangerBrush}" Text="{Binding ErrorStr,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBlock>
<Border Grid.Row="1" Name="Border" Background="White" Grid.Column="1" CornerRadius="{Binding CornerRadius,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" BorderThickness="1" BorderBrush="Transparent">
@@ -56,7 +56,7 @@
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding PlaceHolder,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" HorizontalAlignment="Left" Padding="10,0" FontSize="14" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource String2VisibilityConverter}}" VerticalAlignment="Center" Foreground="{DynamicResource ThirdlyTextBrush}"/>
<TextBox Grid.Column="0" MouseWheel="MyTextBox_OnMouseWheel" HorizontalContentAlignment="{Binding HorizontalTextAlignment,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" TextChanged="InputBox_OnTextChanged" MouseLeave="InputBox_OnMouseLeave" MouseEnter="InputBox_OnMouseEnter" GotFocus="InputBox_OnGotFocus" LostFocus="InputBox_OnLostFocus" Name="MyTextBox" Margin="4,0" BorderThickness="0" VerticalContentAlignment="Center" Padding="{Binding TextPadding,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" Text="{Binding Value,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},UpdateSourceTrigger=PropertyChanged}" Background="{x:Null}"></TextBox>
<Button Padding="7" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource String2VisibilityFeConverter}}" Focusable="True" Grid.Column="1" Name="ButtonClear" Click="ButtonClear_OnClick" Foreground="{DynamicResource ThirdlyTextBrush}" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Style="{StaticResource ButtonIconTransparent}" Width="36" HorizontalAlignment="Right"></Button>
<Button Padding="7" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource String2VisibilityReConverter}}" Focusable="True" Grid.Column="1" Name="ButtonClear" Click="ButtonClear_OnClick" Foreground="{DynamicResource ThirdlyTextBrush}" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Style="{StaticResource ButtonIconTransparent}" Width="36" HorizontalAlignment="Right"></Button>
<Button Visibility="{Binding ShowUpDownButton,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource Boolean2VisibilityConverter}}" Padding="7,7,7,3" Focusable="True" Grid.Column="2" Click="ButtonUp_OnClick" Foreground="{DynamicResource ThirdlyTextBrush}" controls:IconElement.Geometry="{StaticResource UpGeometry}" Style="{StaticResource ButtonIconTransparent}" Width="36" HorizontalAlignment="Right" VerticalAlignment="Top" Height="17"></Button>
<Button Visibility="{Binding ShowUpDownButton,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource Boolean2VisibilityConverter}}" Padding="7,3,7,7" Focusable="True" Grid.Column="2" Click="ButtonDown_OnClick" Foreground="{DynamicResource ThirdlyTextBrush}" controls:IconElement.Geometry="{StaticResource DownGeometry}" Style="{StaticResource ButtonIconTransparent}" Width="36" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="17"></Button>
</Grid>
+2 -2
View File
@@ -43,7 +43,7 @@
</Grid.RowDefinitions>
<StackPanel Name="StackPanelTitle" Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock Visibility="{Binding IsNeedly,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource Boolean2VisibilityConverter}}" VerticalAlignment="Center" Margin="0,0,6,0" Text="*" Foreground="{DynamicResource DangerBrush}"></TextBlock>
<TextBlock Style="{StaticResource TextBlockDefault}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource String2VisibilityFeConverter}}" Margin="0,0,10,0" Text="{Binding Title,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBlock>
<TextBlock Style="{StaticResource TextBlockDefault}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource String2VisibilityReConverter}}" Margin="0,0,10,0" Text="{Binding Title,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBlock>
</StackPanel>
<TextBlock Margin="4,0,0,1" Grid.Row="1" Name="TextBlockError" Grid.Column="1" VerticalAlignment="Bottom" FontSize="12" Foreground="{DynamicResource DangerBrush}" Text="{Binding ErrorStr,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"></TextBlock>
<Border Grid.Row="1" Name="Border" Background="White" Grid.Column="1" CornerRadius="{Binding CornerRadius,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" BorderThickness="1" BorderBrush="Transparent">
@@ -54,7 +54,7 @@
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding PlaceHolder,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" HorizontalAlignment="Left" Padding="10,0" FontSize="14" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource String2VisibilityConverter}}" VerticalAlignment="Center" Foreground="{DynamicResource ThirdlyTextBrush}"/>
<TextBox MaxLines="1" MaxLength="{Binding MaxLength,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" HorizontalContentAlignment="{Binding HorizontalTextAlignment,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" Grid.Column="0" TextChanged="InputBox_OnTextChanged" MouseLeave="InputBox_OnMouseLeave" MouseEnter="InputBox_OnMouseEnter" GotFocus="InputBox_OnGotFocus" LostFocus="InputBox_OnLostFocus" Name="MyTextBox" Margin="4,0" BorderThickness="0" VerticalContentAlignment="Center" Padding="{Binding TextPadding,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" Text="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},UpdateSourceTrigger=PropertyChanged}" Background="{x:Null}"></TextBox>
<Button Padding="7" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource String2VisibilityFeConverter}}" Focusable="True" Grid.Column="1" Name="ButtonClear" Click="ButtonClear_OnClick" Foreground="{DynamicResource ThirdlyTextBrush}" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Style="{StaticResource ButtonIconTransparent}" Width="36" HorizontalAlignment="Right"></Button>
<Button Padding="7" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource String2VisibilityReConverter}}" Focusable="True" Grid.Column="1" Name="ButtonClear" Click="ButtonClear_OnClick" Foreground="{DynamicResource ThirdlyTextBrush}" controls:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Style="{StaticResource ButtonIconTransparent}" Width="36" HorizontalAlignment="Right"></Button>
</Grid>
</Border>
</Grid>
@@ -0,0 +1,225 @@
using System;
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using HandyControl.Tools.Extension;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
public class TabControl : System.Windows.Controls.TabControl
{
private const string OverflowButtonKey = "PART_OverflowButton";
private const string HeaderPanelKey = "PART_HeaderPanel";
private ContextMenuToggleButton _buttonOverflow;
private TabPanel _headerPanel;
/// <summary>
/// 是否为内部操作
/// </summary>
internal bool IsInternalAction;
/// <summary>
/// 是否启用动画
/// </summary>
public static readonly DependencyProperty IsEnableAnimationProperty = DependencyProperty.Register(
"IsEnableAnimation", typeof(bool), typeof(TabControl), new PropertyMetadata(default(bool)));
/// <summary>
/// 是否启用动画
/// </summary>
public bool IsEnableAnimation
{
get => (bool)GetValue(IsEnableAnimationProperty);
set => SetValue(IsEnableAnimationProperty, value);
}
/// <summary>
/// 是否可以拖动
/// </summary>
public static readonly DependencyProperty IsDraggableProperty = DependencyProperty.Register(
"IsDraggable", typeof(bool), typeof(TabControl), new PropertyMetadata(default(bool)));
/// <summary>
/// 是否可以拖动
/// </summary>
public bool IsDraggable
{
get => (bool)GetValue(IsDraggableProperty);
set => SetValue(IsDraggableProperty, value);
}
/// <summary>
/// 是否显示关闭按钮
/// </summary>
public static readonly DependencyProperty ShowCloseButtonProperty = DependencyProperty.Register(
"ShowCloseButton", typeof(bool), typeof(TabControl), new PropertyMetadata(default(bool)));
/// <summary>
/// 是否显示关闭按钮
/// </summary>
public bool ShowCloseButton
{
get => (bool)GetValue(ShowCloseButtonProperty);
set => SetValue(ShowCloseButtonProperty, value);
}
/// <summary>
/// 是否将标签填充
/// </summary>
public static readonly DependencyProperty IsEnableTabFillProperty = DependencyProperty.Register(
"IsEnableTabFill", typeof(bool), typeof(TabControl), new PropertyMetadata(default(bool)));
/// <summary>
/// 是否将标签填充
/// </summary>
public bool IsEnableTabFill
{
get => (bool)GetValue(IsEnableTabFillProperty);
set => SetValue(IsEnableTabFillProperty, value);
}
/// <summary>
/// 标签宽度
/// </summary>
public static readonly DependencyProperty TabItemWidthProperty = DependencyProperty.Register(
"TabItemWidth", typeof(double), typeof(TabControl), new PropertyMetadata(200.0));
/// <summary>
/// 标签宽度
/// </summary>
public double TabItemWidth
{
get => (double)GetValue(TabItemWidthProperty);
set => SetValue(TabItemWidthProperty, value);
}
/// <summary>
/// 标签高度
/// </summary>
public static readonly DependencyProperty TabItemHeightProperty = DependencyProperty.Register(
"TabItemHeight", typeof(double), typeof(TabControl), new PropertyMetadata(30.0));
/// <summary>
/// 标签高度
/// </summary>
public double TabItemHeight
{
get => (double)GetValue(TabItemHeightProperty);
set => SetValue(TabItemHeightProperty, value);
}
/// <summary>
/// 可见的标签数量
/// </summary>
private int _itemShowCount;
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
{
base.OnItemsChanged(e);
if (_headerPanel == null)
{
IsInternalAction = false;
return;
}
if (!IsEnableTabFill)
{
_itemShowCount = (int)(ActualWidth / TabItemWidth);
_buttonOverflow.Show(Items.Count >= _itemShowCount);
}
if (IsInternalAction)
{
IsInternalAction = false;
return;
}
if (IsEnableAnimation)
{
_headerPanel.ClearValue(TabPanel.FluidMoveDurationProperty);
}
else
{
_headerPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
}
if (e.Action == NotifyCollectionChangedAction.Add)
{
foreach (UIElement item in e.NewItems)
{
item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
}
}
IsInternalAction = false;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_headerPanel = Template.FindName(HeaderPanelKey, this) as TabPanel;
if (IsEnableTabFill) return;
_buttonOverflow = Template.FindName(OverflowButtonKey, this) as ContextMenuToggleButton;
if (_buttonOverflow != null)
{
_itemShowCount = (int)(ActualWidth / TabItemWidth);
_buttonOverflow.Show(Items.Count >= _itemShowCount);
var menu = new ContextMenu
{
Placement = PlacementMode.Bottom,
PlacementTarget = _buttonOverflow
};
menu.Closed += (s, e) => _buttonOverflow.IsChecked = false;
_buttonOverflow.Menu = menu;
_buttonOverflow.Click += (s, e) =>
{
if (_buttonOverflow.IsChecked == true)
{
_buttonOverflow.Menu.Items.Clear();
foreach (TabItem item in Items)
{
var menuItem = new MenuItem
{
Header = item.Header,
Width = TabItemWidth,
IsChecked = item.IsSelected,
IsCheckable = true
};
menuItem.Click += delegate
{
_buttonOverflow.IsChecked = false;
var index = Items.IndexOf(item);
if (index >= _itemShowCount)
{
Items.Remove(item);
Items.Insert(0, item);
if (IsEnableAnimation)
{
_headerPanel.ClearValue(TabPanel.FluidMoveDurationProperty);
}
else
{
_headerPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
}
_headerPanel.ForceUpdate = true;
_headerPanel.Measure(new Size(_headerPanel.DesiredSize.Width, ActualHeight));
_headerPanel.ForceUpdate = false;
}
item.IsSelected = true;
};
_buttonOverflow.Menu.Items.Add(menuItem);
}
}
};
}
}
}
}
+304
View File
@@ -0,0 +1,304 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using HandyControl.Tools;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
[TemplatePart(Name = CloseButtonKey, Type = typeof(Button))]
public class TabItem : System.Windows.Controls.TabItem
{
private const string CloseButtonKey = "PART_CloseButton";
private Button _buttonClose;
/// <summary>
/// 动画速度
/// </summary>
private const int AnimationSpeed = 150;
/// <summary>
/// 选项卡是否处于拖动状态
/// </summary>
private static bool ItemIsDragging;
/// <summary>
/// 选项卡是否等待被拖动
/// </summary>
private bool _isWaiting;
/// <summary>
/// 拖动中的选项卡坐标
/// </summary>
private Point _dragPoint;
/// <summary>
/// 鼠标按下时选项卡位置
/// </summary>
private int _mouseDownIndex;
/// <summary>
/// 鼠标按下时选项卡横向偏移
/// </summary>
private double _mouseDownOffsetX;
/// <summary>
/// 鼠标按下时的坐标
/// </summary>
private Point _mouseDownPoint;
/// <summary>
/// 右侧可移动的最大值
/// </summary>
private double _maxMoveRight;
/// <summary>
/// 左侧可移动的最大值
/// </summary>
private double _maxMoveLeft;
/// <summary>
/// 选项卡宽度
/// </summary>
public double ItemWidth { get; internal set; }
/// <summary>
/// 选项卡拖动等待距离(在鼠标移动了超过20个像素无关单位后,选项卡才开始被拖动)
/// </summary>
private const double WaitLength = 20;
/// <summary>
/// 选项卡是否处于拖动状态
/// </summary>
private bool _isDragging;
/// <summary>
/// 选项卡是否已经被拖动
/// </summary>
private bool _isDragged;
/// <summary>
/// 目标横向位移
/// </summary>
internal double TargetOffsetX { get; set; }
/// <summary>
/// 当前编号
/// </summary>
private int _currentIndex;
/// <summary>
/// 标签容器
/// </summary>
private TabPanel _tabPanel;
/// <summary>
/// 当前编号
/// </summary>
internal int CurrentIndex
{
get => _currentIndex;
set
{
if (_currentIndex == value || value < 0) return;
var oldIndex = _currentIndex;
_currentIndex = value;
UpdateItemOffsetX(oldIndex);
}
}
private bool _isLoaded;
/// <summary>
/// 更新选项卡横向偏移
/// </summary>
/// <param name="oldIndex"></param>
private void UpdateItemOffsetX(int oldIndex)
{
if (!_isDragging) return;
var moveItem = _tabPanel.ItemDic[CurrentIndex];
moveItem.CurrentIndex -= CurrentIndex - oldIndex;
var offsetX = moveItem.TargetOffsetX;
var resultX = offsetX + (oldIndex - CurrentIndex) * ItemWidth;
_tabPanel.ItemDic[CurrentIndex] = this;
_tabPanel.ItemDic[moveItem.CurrentIndex] = moveItem;
moveItem.CreateAnimation(offsetX, resultX);
}
public TabItem()
{
Loaded += (s, e) =>
{
if (_isLoaded) return;
_tabPanel = VisualParent as TabPanel;
_isLoaded = true;
};
//CommandBindings.Add(new CommandBinding(CloseOtherCommand, (s, e) =>
//{
// var enumerator = ((IEnumerable)TabControlParent.Items).GetEnumerator();
// while (enumerator.MoveNext())
// {
// var item = enumerator.Current;
// if (!Equals(item) && item != null)
// {
// TabControlParent.Items.Remove(item);
// enumerator = ((IEnumerable)TabControlParent.Items).GetEnumerator();
// }
// }
//}));
}
private TabControl TabControlParent => new Lazy<TabControl>(() => ItemsControl.ItemsControlFromItemContainer(this) as TabControl).Value;
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
{
base.OnMouseRightButtonDown(e);
IsSelected = true;
Focus();
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_buttonClose = Template.FindName(CloseButtonKey, this) as Button;
if (_buttonClose != null)
{
_buttonClose.Click += (s, e) =>
{
if (TabControlParent.IsEnableAnimation)
{
_tabPanel.ClearValue(TabPanel.FluidMoveDurationProperty);
}
else
{
_tabPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
}
TabControlParent.IsInternalAction = true;
TabControlParent.Items.Remove(this);
};
}
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
if (TabControlParent.IsDraggable && !ItemIsDragging && !_isDragging)
{
_tabPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
_mouseDownOffsetX = RenderTransform.Value.OffsetX;
var mx = TranslatePoint(new Point(), TabControlParent).X;
_mouseDownIndex = CalLocationIndex(mx);
_maxMoveLeft = -_mouseDownIndex * ItemWidth;
_maxMoveRight = TabControlParent.ActualWidth - ActualWidth + _maxMoveLeft;
_isDragging = true;
ItemIsDragging = true;
_isWaiting = true;
_dragPoint = e.GetPosition(TabControlParent);
_mouseDownPoint = _dragPoint;
CaptureMouse();
}
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (ItemIsDragging && _isDragging)
{
var subX = TranslatePoint(new Point(), TabControlParent).X;
CurrentIndex = CalLocationIndex(subX);
var p = e.GetPosition(TabControlParent);
var subLeft = p.X - _dragPoint.X;
var totalLeft = p.X - _mouseDownPoint.X;
if (Math.Abs(subLeft) <= WaitLength && _isWaiting) return;
_isWaiting = false;
_isDragged = true;
var left = subLeft + RenderTransform.Value.OffsetX;
if (totalLeft < _maxMoveLeft)
{
left = _maxMoveLeft + _mouseDownOffsetX;
}
else if (totalLeft > _maxMoveRight)
{
left = _maxMoveRight + _mouseDownOffsetX;
}
var t = new TranslateTransform(left, 0);
RenderTransform = t;
_dragPoint = p;
}
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
ReleaseMouseCapture();
if (_isDragged)
{
var subX = TranslatePoint(new Point(), TabControlParent).X;
var index = CalLocationIndex(subX);
var left = index * ItemWidth;
var offsetX = RenderTransform.Value.OffsetX;
CreateAnimation(offsetX, offsetX - subX + left, index);
}
_isDragging = false;
ItemIsDragging = false;
_isDragged = false;
}
/// <summary>
/// 创建动画
/// </summary>
internal void CreateAnimation(double offsetX, double resultX, int index = -1)
{
void AnimationCompleted()
{
RenderTransform = new TranslateTransform(resultX, 0);
if (index == -1) return;
var parent = TabControlParent;
_tabPanel.CanUpdate = false;
parent.IsInternalAction = true;
parent.Items.Remove(this);
parent.IsInternalAction = true;
parent.Items.Insert(index, this);
_tabPanel.CanUpdate = true;
_tabPanel.ForceUpdate = true;
_tabPanel.Measure(new Size(_tabPanel.DesiredSize.Width, ActualHeight));
_tabPanel.ForceUpdate = false;
Focus();
IsSelected = true;
}
TargetOffsetX = resultX;
if (!TabControlParent.IsEnableAnimation)
{
AnimationCompleted();
return;
}
var animation = AnimationHelper.CreateAnimation(resultX, AnimationSpeed);
animation.FillBehavior = FillBehavior.Stop;
animation.Completed += (s1, e1) => AnimationCompleted();
var f = new TranslateTransform(offsetX, 0);
RenderTransform = f;
f.BeginAnimation(TranslateTransform.XProperty, animation);
}
/// <summary>
/// 计算选项卡当前合适的位置编号
/// </summary>
/// <param name="left"></param>
/// <returns></returns>
private int CalLocationIndex(double left)
{
var maxIndex = TabControlParent.Items.Count - 1;
var div = (int)(left / ItemWidth);
var rest = left % ItemWidth;
var result = rest / ItemWidth > .5 ? div + 1 : div;
return result > maxIndex ? maxIndex : result;
}
}
}
@@ -0,0 +1,169 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using HandyControl.Tools;
// ReSharper disable once CheckNamespace
namespace HandyControl.Controls
{
public class TabPanel : Panel
{
private int _itemCount;
/// <summary>
/// 是否可以更新
/// </summary>
internal bool CanUpdate = true;
/// <summary>
/// 选项卡字典
/// </summary>
internal Dictionary<int, TabItem> ItemDic = new Dictionary<int, TabItem>();
/// <summary>
/// 流式行为持续时间
/// </summary>
public static readonly DependencyProperty FluidMoveDurationProperty = DependencyProperty.Register(
"FluidMoveDuration", typeof(Duration), typeof(TabPanel), new PropertyMetadata(new Duration(TimeSpan.FromMilliseconds(200))));
/// <summary>
/// 流式行为持续时间
/// </summary>
public Duration FluidMoveDuration
{
get => (Duration)GetValue(FluidMoveDurationProperty);
set => SetValue(FluidMoveDurationProperty, value);
}
/// <summary>
/// 是否将标签填充
/// </summary>
public static readonly DependencyProperty IsEnableTabFillProperty = DependencyProperty.Register(
"IsEnableTabFill", typeof(bool), typeof(TabPanel), new PropertyMetadata(default(bool)));
/// <summary>
/// 是否将标签填充
/// </summary>
public bool IsEnableTabFill
{
get => (bool)GetValue(IsEnableTabFillProperty);
set => SetValue(IsEnableTabFillProperty, value);
}
/// <summary>
/// 标签宽度
/// </summary>
public static readonly DependencyProperty TabItemWidthProperty = DependencyProperty.Register(
"TabItemWidth", typeof(double), typeof(TabPanel), new PropertyMetadata(200.0));
/// <summary>
/// 标签宽度
/// </summary>
public double TabItemWidth
{
get => (double)GetValue(TabItemWidthProperty);
set => SetValue(TabItemWidthProperty, value);
}
/// <summary>
/// 标签高度
/// </summary>
public static readonly DependencyProperty TabItemHeightProperty = DependencyProperty.Register(
"TabItemHeight", typeof(double), typeof(TabPanel), new PropertyMetadata(30.0));
/// <summary>
/// 标签高度
/// </summary>
public double TabItemHeight
{
get => (double)GetValue(TabItemHeightProperty);
set => SetValue(TabItemHeightProperty, value);
}
/// <summary>
/// 是否可以强制更新
/// </summary>
internal bool ForceUpdate;
private Size _oldSize;
/// <summary>
/// 是否已经加载
/// </summary>
private bool _isLoaded;
protected override Size MeasureOverride(Size constraint)
{
if ((_itemCount == InternalChildren.Count || !CanUpdate) && !ForceUpdate) return _oldSize;
constraint.Height = TabItemHeight;
_itemCount = InternalChildren.Count;
var size = new Size();
ItemDic.Clear();
var count = InternalChildren.Count;
if (count == 0)
{
_oldSize.Width = 0;
return _oldSize;
}
constraint.Width += InternalChildren.Count;
var itemWidth = .0;
var arr = new int[count];
if (!IsEnableTabFill)
{
itemWidth = TabItemWidth;
}
else
{
arr = ArithmeticHelper.DivideInt2Arr((int)constraint.Width, count);
}
for (var index = 0; index < count; index++)
{
if (IsEnableTabFill)
{
itemWidth = arr[index];
}
if (InternalChildren[index] is TabItem tabItem)
{
tabItem.RenderTransform = new TranslateTransform();
tabItem.MaxWidth = itemWidth;
var rect = new Rect
{
X = size.Width - tabItem.BorderThickness.Left,
Width = itemWidth,
Height = TabItemHeight
};
Console.WriteLine(rect);
tabItem.Arrange(rect);
tabItem.ItemWidth = itemWidth - tabItem.BorderThickness.Left;
tabItem.CurrentIndex = index;
tabItem.TargetOffsetX = 0;
ItemDic[index] = tabItem;
size.Width += tabItem.ItemWidth;
}
}
size.Height = constraint.Height;
_oldSize = size;
return _oldSize;
}
public TabPanel()
{
Loaded += (s, e) =>
{
if (_isLoaded) return;
ForceUpdate = true;
Measure(new Size(DesiredSize.Width, ActualHeight));
ForceUpdate = false;
_isLoaded = true;
};
}
}
}
+1 -1
View File
@@ -40,7 +40,7 @@
<TextBlock FontSize="16" Text="{Binding SelectedTime,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Top" Margin="0,14,0,0" HorizontalAlignment="Center"></TextBlock>
</Border>
<TextBlock Visibility="{Binding ShowSpeStr,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Converter={StaticResource Boolean2VisibilityConverter}}" Text="{Binding SpeStr,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,14,10,0"></TextBlock>
<TextBlock Visibility="Collapsed" Name="TextBlockSelected" HorizontalAlignment="Left" Text="2017-10-16 06:29:28" VerticalAlignment="Top" Margin="0,2,0,0"></TextBlock>
<TextBlock Visibility="Collapsed" Name="TextBlockSelected" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,2,0,0"></TextBlock>
<Border Width="1" Background="{DynamicResource DangerBrush}"></Border>
<Canvas Name="CanvasSpe" VerticalAlignment="Bottom" Height="28" ></Canvas>
<Border PreviewMouseLeftButtonUp="BorderTop_OnPreviewMouseLeftButtonUp" MouseLeftButtonDown="BorderTop_OnMouseLeftButtonDown" Name="BorderTop" Background="Transparent" Cursor="Hand">
+10 -10
View File
@@ -23,7 +23,7 @@ namespace HandyControl.Controls
/// 刻度字符串
/// </summary>
private static readonly DependencyProperty SpeStrProperty = DependencyProperty.Register(
"SpeStr", typeof(string), typeof(TimeBar), new PropertyMetadata("间隔1小时"));
"SpeStr", typeof(string), typeof(TimeBar), new PropertyMetadata(Properties.Langs.Lang.Interval1h));
/// <summary>
/// 选中时间
@@ -150,13 +150,13 @@ namespace HandyControl.Controls
if (value < 0)
{
SpeStr = "间隔2小时";
SpeStr = Properties.Langs.Lang.Interval2h;
_speIndex = 0;
return;
}
if (value > 6)
{
SpeStr = "间隔30秒";
SpeStr = Properties.Langs.Lang.Interval30s;
_speIndex = 6;
return;
}
@@ -164,26 +164,26 @@ namespace HandyControl.Controls
switch (value)
{
case 0:
SpeStr = "间隔2小时";
SpeStr = Properties.Langs.Lang.Interval2h;
break;
case 1:
SpeStr = "间隔1小时";
SpeStr = Properties.Langs.Lang.Interval1h;
break;
case 2:
SpeStr = "间隔30分钟";
SpeStr = Properties.Langs.Lang.Interval30m;
break;
case 3:
SpeStr = "间隔10分钟";
SpeStr = Properties.Langs.Lang.Interval10m;
break;
case 4:
SpeStr = "间隔5分钟";
SpeStr = Properties.Langs.Lang.Interval5m;
break;
case 5:
SpeStr = "间隔1分钟";
SpeStr = Properties.Langs.Lang.Interval1m;
break;
case 6:
SetSpeTimeFormat("HH:mm:ss");
SpeStr = "间隔30秒";
SpeStr = Properties.Langs.Lang.Interval30s;
break;
}
_speIndex = value;
@@ -75,7 +75,7 @@
<TextBlock Text="{Binding ImgPath,ElementName=UserControlMain}" Foreground="White" Margin="10,0,0,0"></TextBlock>
<TextBlock Text="{Binding ImgSize,ElementName=UserControlMain,Converter={StaticResource Long2FileSizeConverter}}" Foreground="White" Margin="30,0,0,0"></TextBlock>
</StackPanel>
<Button WindowChrome.IsHitTestVisibleInChrome="True" Click="ButtonClose_OnClick" Background="{DynamicResource DangerBrush}" Grid.Row="0" Padding="14" controls:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIconTransparent}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40"></Button>
<Button WindowChrome.IsHitTestVisibleInChrome="True" Click="ButtonClose_OnClick" Background="Red" Grid.Row="0" Padding="14" controls:IconElement.Geometry="{StaticResource DeleteGeometry}" Style="{StaticResource ButtonIconTransparent}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="40" Height="40"></Button>
</Grid>
</Grid>
</controls:WindowBorderless>
@@ -56,7 +56,7 @@ namespace HandyControl.Controls
/// </summary>
private static readonly SaveFileDialog SaveFileDialog = new SaveFileDialog
{
Filter = "PNG图片|*.png"
Filter = $"{Properties.Langs.Lang.PngImg}|*.png"
};
public static readonly DependencyProperty ImgPathProperty = DependencyProperty.Register(
@@ -211,7 +211,7 @@ namespace HandyControl.Controls
}
catch
{
PopupWindow.ShowDialog("非法的图片路径!");
PopupWindow.ShowDialog(Properties.Langs.Lang.ErrorImgPath);
}
}
@@ -343,7 +343,7 @@ namespace HandyControl.Controls
if (Math.Abs(height - 0) < 0.001 || Math.Abs(width - 0) < 0.001)
{
PopupWindow.ShowDialog("非法的图片尺寸!");
PopupWindow.ShowDialog(Properties.Langs.Lang.ErrorImgSize);
return;
}
_imgWidHeiScale = width / height;
@@ -395,7 +395,7 @@ namespace HandyControl.Controls
private void ButtonSave_OnClick(object sender, RoutedEventArgs e)
{
SaveFileDialog.FileName = $"{DateTime.Now:yyyy年M月d日h时m分s.fff秒}";
SaveFileDialog.FileName = $"{DateTime.Now:yyyy-M-d-h-m-s.fff}";
if (SaveFileDialog.ShowDialog() == true)
{
var path = SaveFileDialog.FileName;
+39 -5
View File
@@ -38,6 +38,8 @@
<Compile Include="Controls\Attach\BorderElement.cs" />
<Compile Include="Controls\Attach\IconSwitchElement.cs" />
<Compile Include="Controls\Attach\StatusSwitchElement.cs" />
<Compile Include="Controls\Button\ContextMenuButton.cs" />
<Compile Include="Controls\Button\ContextMenuToggleButton.cs" />
<Compile Include="Controls\Carousel.xaml.cs">
<DependentUpon>Carousel.xaml</DependentUpon>
</Compile>
@@ -63,6 +65,9 @@
<Compile Include="Controls\Pagination.xaml.cs">
<DependentUpon>Pagination.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\TabControl\TabControl.cs" />
<Compile Include="Controls\TabControl\TabItem.cs" />
<Compile Include="Controls\TabControl\TabPanel.cs" />
<Compile Include="Controls\TimeBar\SpeTextBlock.cs" />
<Compile Include="Controls\TimeBar\TimeBar.xaml.cs">
<DependentUpon>TimeBar.xaml</DependentUpon>
@@ -96,12 +101,14 @@
<Compile Include="Interactivity\FluidMoveScope.cs" />
<Compile Include="Interactivity\IAttachedObject.cs" />
<Compile Include="Interactivity\Interaction.cs" />
<Compile Include="Interactivity\InvokeCommandAction.cs" />
<Compile Include="Interactivity\MouseDragElementBehavior.cs" />
<Compile Include="Interactivity\NameResolvedEventArgs.cs" />
<Compile Include="Interactivity\NameResolver.cs" />
<Compile Include="Interactivity\PreviewInvokeEventArgs.cs" />
<Compile Include="Interactivity\TagType.cs" />
<Compile Include="Interactivity\TransitionEffect.cs" />
<Compile Include="Interactivity\TriggerAction!1.cs" />
<Compile Include="Interactivity\TriggerAction.cs" />
<Compile Include="Interactivity\TriggerActionCollection.cs" />
<Compile Include="Interactivity\TriggerBase.cs" />
@@ -110,19 +117,28 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Langs\Lang.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Lang.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Langs\Lang.en.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Lang.en.resx</DependentUpon>
</Compile>
<Compile Include="Tools\AnimationHelper.cs" />
<Compile Include="Tools\ArithmeticHelper.cs" />
<Compile Include="Tools\Converter\Boolean2BooleanFeConverter.cs" />
<Compile Include="Tools\Converter\Boolean2VisibilityFeConverter.cs" />
<Compile Include="Tools\Converter\Boolean2BooleanReConverter.cs" />
<Compile Include="Tools\Converter\Boolean2VisibilityReConverter.cs" />
<Compile Include="Tools\Converter\BooleanArr2VisibilityConverter.cs" />
<Compile Include="Tools\Converter\Color2ChannelAConverter.cs" />
<Compile Include="Tools\Converter\Color2HexStrConverter.cs" />
<Compile Include="Tools\Converter\IsNullConverter.cs" />
<Compile Include="Tools\Converter\Long2FileSizeConverter.cs" />
<Compile Include="Tools\Converter\Object2BooleanConverter.cs" />
<Compile Include="Tools\Converter\Source2ImageConverter.cs" />
<Compile Include="Tools\Converter\String2VisibilityConverter.cs" />
<Compile Include="Tools\Converter\String2VisibilityFeConverter.cs" />
<Compile Include="Tools\Converter\String2VisibilityReConverter.cs" />
<Compile Include="Tools\Converter\TreeViewItemMarginConverter.cs" />
<Compile Include="Tools\Extension\ColorExtension.cs" />
<Compile Include="Tools\Extension\UIElementExtension.cs" />
@@ -268,6 +284,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\ContentControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\ContextMenu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -304,6 +324,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\TabControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\TextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -332,6 +356,16 @@
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<EmbeddedResource Include="Properties\Langs\Lang.en.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Lang.en.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Langs\Lang.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,72 @@
using System;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
namespace HandyControl.Interactivity
{
public sealed class InvokeCommandAction : TriggerAction<DependencyObject>
{
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(InvokeCommandAction), null);
public static readonly DependencyProperty CommandParameterProperty =
DependencyProperty.Register(nameof(CommandParameter), typeof(object), typeof(InvokeCommandAction),
null);
private string _commandName;
public string CommandName
{
get
{
ReadPreamble();
return _commandName;
}
set
{
if (CommandName == value)
return;
WritePreamble();
_commandName = value;
WritePostscript();
}
}
public ICommand Command
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
public object CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
}
protected override void Invoke(object parameter)
{
if (AssociatedObject == null)
return;
var command = ResolveCommand();
if (command == null || !command.CanExecute(CommandParameter))
return;
command.Execute(CommandParameter);
}
private ICommand ResolveCommand()
{
var command = (ICommand)null;
if (Command != null)
command = Command;
else if (AssociatedObject != null)
foreach (var property in AssociatedObject.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public))
if (typeof(ICommand).IsAssignableFrom(property.PropertyType) &&
string.Equals(property.Name, CommandName, StringComparison.Ordinal))
command = (ICommand)property.GetValue(AssociatedObject, null);
return command;
}
}
}
@@ -0,0 +1,19 @@
using System;
using System.Windows;
namespace HandyControl.Interactivity
{
public abstract class TriggerAction<T> : TriggerAction where T : DependencyObject
{
protected TriggerAction() : base(typeof(T))
{
}
#pragma warning disable 108,114
protected T AssociatedObject => (T)base.AssociatedObject;
#pragma warning restore 108,114
protected sealed override Type AssociatedObjectTypeConstraint =>
base.AssociatedObjectTypeConstraint;
}
}
+2 -2
View File
@@ -9,12 +9,12 @@ namespace HandyControl.Interactivity
[ContentProperty("Actions")]
public abstract class TriggerBase : Animatable, IAttachedObject
{
public static readonly DependencyProperty ActionsProperty = ActionsPropertyKey.DependencyProperty;
private static readonly DependencyPropertyKey ActionsPropertyKey =
DependencyProperty.RegisterReadOnly("Actions", typeof(TriggerActionCollection), typeof(TriggerBase),
new FrameworkPropertyMetadata());
public static readonly DependencyProperty ActionsProperty = ActionsPropertyKey.DependencyProperty;
private DependencyObject _associatedObject;
private readonly Type _associatedObjectTypeConstraint;
+2 -2
View File
@@ -10,5 +10,5 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
+207
View File
@@ -0,0 +1,207 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace HandyControl.Properties.Langs {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Lang {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Lang() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HandyControl.Properties.Langs.Lang", typeof(Lang).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找类似 取消 的本地化字符串。
/// </summary>
public static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// 查找类似 清空 的本地化字符串。
/// </summary>
public static string Clear {
get {
return ResourceManager.GetString("Clear", resourceCulture);
}
}
/// <summary>
/// 查找类似 确定 的本地化字符串。
/// </summary>
public static string Confirm {
get {
return ResourceManager.GetString("Confirm", resourceCulture);
}
}
/// <summary>
/// 查找类似 错误的图片路径! 的本地化字符串。
/// </summary>
public static string ErrorImgPath {
get {
return ResourceManager.GetString("ErrorImgPath", resourceCulture);
}
}
/// <summary>
/// 查找类似 非法的图片尺寸! 的本地化字符串。
/// </summary>
public static string ErrorImgSize {
get {
return ResourceManager.GetString("ErrorImgSize", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔10分钟 的本地化字符串。
/// </summary>
public static string Interval10m {
get {
return ResourceManager.GetString("Interval10m", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔1小时 的本地化字符串。
/// </summary>
public static string Interval1h {
get {
return ResourceManager.GetString("Interval1h", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔1分钟 的本地化字符串。
/// </summary>
public static string Interval1m {
get {
return ResourceManager.GetString("Interval1m", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔2小时 的本地化字符串。
/// </summary>
public static string Interval2h {
get {
return ResourceManager.GetString("Interval2h", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔30分钟 的本地化字符串。
/// </summary>
public static string Interval30m {
get {
return ResourceManager.GetString("Interval30m", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔30秒 的本地化字符串。
/// </summary>
public static string Interval30s {
get {
return ResourceManager.GetString("Interval30s", resourceCulture);
}
}
/// <summary>
/// 查找类似 间隔5分钟 的本地化字符串。
/// </summary>
public static string Interval5m {
get {
return ResourceManager.GetString("Interval5m", resourceCulture);
}
}
/// <summary>
/// 查找类似 PNG图片 的本地化字符串。
/// </summary>
public static string PngImg {
get {
return ResourceManager.GetString("PngImg", resourceCulture);
}
}
/// <summary>
/// 查找类似 过大 的本地化字符串。
/// </summary>
public static string TooLarge {
get {
return ResourceManager.GetString("TooLarge", resourceCulture);
}
}
/// <summary>
/// 查找类似 未知 的本地化字符串。
/// </summary>
public static string Unknown {
get {
return ResourceManager.GetString("Unknown", resourceCulture);
}
}
/// <summary>
/// 查找类似 未知大小 的本地化字符串。
/// </summary>
public static string UnknownSize {
get {
return ResourceManager.GetString("UnknownSize", resourceCulture);
}
}
}
}
View File
Whitespace-only changes.
+168
View File
@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Confirm" xml:space="preserve">
<value>Confirm</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="PngImg" xml:space="preserve">
<value>PNG image</value>
</data>
<data name="ErrorImgPath" xml:space="preserve">
<value>Wrong picture path</value>
</data>
<data name="ErrorImgSize" xml:space="preserve">
<value>Wrong picture size</value>
</data>
<data name="UnknownSize" xml:space="preserve">
<value>Unknown size</value>
</data>
<data name="TooLarge" xml:space="preserve">
<value>Too large</value>
</data>
<data name="Unknown" xml:space="preserve">
<value>Unknown</value>
</data>
<data name="Interval30s" xml:space="preserve">
<value>30 seconds interval</value>
</data>
<data name="Interval1m" xml:space="preserve">
<value>1 minute interval</value>
</data>
<data name="Interval5m" xml:space="preserve">
<value>5 minutes interval</value>
</data>
<data name="Interval10m" xml:space="preserve">
<value>10 minutes interval</value>
</data>
<data name="Interval30m" xml:space="preserve">
<value>30 minutes interval</value>
</data>
<data name="Interval1h" xml:space="preserve">
<value>1 hour interval</value>
</data>
<data name="Interval2h" xml:space="preserve">
<value>2 hour interval</value>
</data>
<data name="Clear" xml:space="preserve">
<value>Clear</value>
</data>
</root>
+148
View File
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Confirm" xml:space="preserve">
<value>确定</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="PngImg" xml:space="preserve">
<value>PNG图片</value>
</data>
<data name="ErrorImgPath" xml:space="preserve">
<value>错误的图片路径!</value>
</data>
<data name="ErrorImgSize" xml:space="preserve">
<value>非法的图片尺寸!</value>
</data>
<data name="UnknownSize" xml:space="preserve">
<value>未知大小</value>
</data>
<data name="TooLarge" xml:space="preserve">
<value>过大</value>
</data>
<data name="Unknown" xml:space="preserve">
<value>未知</value>
</data>
<data name="Interval30s" xml:space="preserve">
<value>间隔30秒</value>
</data>
<data name="Interval1m" xml:space="preserve">
<value>间隔1分钟</value>
</data>
<data name="Interval5m" xml:space="preserve">
<value>间隔5分钟</value>
</data>
<data name="Interval10m" xml:space="preserve">
<value>间隔10分钟</value>
</data>
<data name="Interval30m" xml:space="preserve">
<value>间隔30分钟</value>
</data>
<data name="Interval1h" xml:space="preserve">
<value>间隔1小时</value>
</data>
<data name="Interval2h" xml:space="preserve">
<value>间隔2小时</value>
</data>
<data name="Clear" xml:space="preserve">
<value>清空</value>
</data>
</root>
+20 -6
View File
@@ -1,9 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="PrimaryBrush" Color="{DynamicResource PrimaryColor}"></SolidColorBrush>
<LinearGradientBrush x:Key="PrimaryBrush" EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource PrimaryColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="DarkPrimaryBrush" Color="{DynamicResource DarkPrimaryColor}"></SolidColorBrush>
<SolidColorBrush x:Key="LightPrimaryBrush" Color="{DynamicResource LightPrimaryColor}"></SolidColorBrush>
<SolidColorBrush x:Key="PrimaryTextBrush" Color="{DynamicResource PrimaryTextColor}"></SolidColorBrush>
<SolidColorBrush x:Key="SecondaryTextBrush" Color="{DynamicResource SecondaryTextColor}"></SolidColorBrush>
@@ -17,16 +19,28 @@
<SolidColorBrush x:Key="DefaultBrush" Color="{DynamicResource DefaultColor}"></SolidColorBrush>
<SolidColorBrush x:Key="DarkDefaultBrush" Color="{DynamicResource DarkDefaultColor}"></SolidColorBrush>
<SolidColorBrush x:Key="DangerBrush" Color="{DynamicResource DangerColor}"></SolidColorBrush>
<LinearGradientBrush x:Key="DangerBrush" EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource DangerColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkDangerColor}" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="DarkDangerBrush" Color="{DynamicResource DarkDangerColor}"></SolidColorBrush>
<SolidColorBrush x:Key="WarningBrush" Color="{DynamicResource WarningColor}"></SolidColorBrush>
<LinearGradientBrush x:Key="WarningBrush" EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource WarningColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkWarningColor}" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="DarkWarningBrush" Color="{DynamicResource DarkWarningColor}"></SolidColorBrush>
<SolidColorBrush x:Key="InfoBrush" Color="{DynamicResource InfoColor}"></SolidColorBrush>
<LinearGradientBrush x:Key="InfoBrush" EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource InfoColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkInfoColor}" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="DarkInfoBrush" Color="{DynamicResource DarkInfoColor}"></SolidColorBrush>
<SolidColorBrush x:Key="SuccessBrush" Color="{DynamicResource SuccessColor}"></SolidColorBrush>
<LinearGradientBrush x:Key="SuccessBrush" EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource SuccessColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="DarkSuccessBrush" Color="{DynamicResource DarkSuccessColor}"></SolidColorBrush>
<SolidColorBrush x:Key="AccentBrush" Color="{DynamicResource AccentColor}"></SolidColorBrush>
+10 -11
View File
@@ -1,21 +1,20 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="PrimaryColor">#2196F3</Color>
<Color x:Key="DarkPrimaryColor">#1976D2</Color>
<Color x:Key="LightPrimaryColor">#81d4fa</Color>
<Color x:Key="PrimaryColor">#73a5ff</Color>
<Color x:Key="DarkPrimaryColor">#5477f5</Color>
<Color x:Key="DangerColor">#d9534f</Color>
<Color x:Key="DarkDangerColor">#d43f3a</Color>
<Color x:Key="DangerColor">#ff8792</Color>
<Color x:Key="DarkDangerColor">#ff4c9f</Color>
<Color x:Key="WarningColor">#f0ad4e</Color>
<Color x:Key="DarkWarningColor">#eea236</Color>
<Color x:Key="WarningColor">#ffd07a</Color>
<Color x:Key="DarkWarningColor">#ff9133</Color>
<Color x:Key="InfoColor">#5bc0de</Color>
<Color x:Key="DarkInfoColor">#46b8da</Color>
<Color x:Key="InfoColor">#4dd0e1</Color>
<Color x:Key="DarkInfoColor">#00bcd4</Color>
<Color x:Key="SuccessColor">#5cb85c</Color>
<Color x:Key="DarkSuccessColor">#4cae4c</Color>
<Color x:Key="SuccessColor">#A5D6A7</Color>
<Color x:Key="DarkSuccessColor">#4CAF50</Color>
<Color x:Key="PrimaryTextColor">#212121</Color>
<Color x:Key="SecondaryTextColor">#757575</Color>
+3 -4
View File
@@ -2,14 +2,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:HandyControl.Tools.Converter">
<converter:Boolean2BooleanFeConverter x:Key="Boolean2BooleanFeConverter"/>
<converter:Boolean2VisibilityFeConverter x:Key="Boolean2VisibilityFeConverter"/>
<converter:Boolean2BooleanReConverter x:Key="Boolean2BooleanReConverter"/>
<converter:Boolean2VisibilityReConverter x:Key="Boolean2VisibilityReConverter"/>
<converter:BooleanArr2VisibilityConverter x:Key="BooleanArr2VisibilityConverter"/>
<converter:IsNullConverter x:Key="IsNullConverter"/>
<converter:Long2FileSizeConverter x:Key="Long2FileSizeConverter"/>
<converter:Source2ImageConverter x:Key="Source2ImageConverter"/>
<converter:String2VisibilityConverter x:Key="String2VisibilityConverter"/>
<converter:String2VisibilityFeConverter x:Key="String2VisibilityFeConverter"/>
<converter:String2VisibilityReConverter x:Key="String2VisibilityReConverter"/>
<BooleanToVisibilityConverter x:Key="Boolean2VisibilityConverter"/>
<converter:TreeViewItemMarginConverter x:Key="TreeViewItemMarginConverter"/>
<converter:Color2HexStrConverter x:Key="Color2HexStrConverter"></converter:Color2HexStrConverter>
+5 -5
View File
@@ -4,10 +4,10 @@
<Color x:Key="MaterialDesignShadow">#AA000000</Color>
<DropShadowEffect x:Key="EffectShadow1" BlurRadius="5" ShadowDepth="1" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".42" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow2" BlurRadius="8" ShadowDepth="1.5" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".42" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow3" BlurRadius="14" ShadowDepth="4.5" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".42" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow4" BlurRadius="25" ShadowDepth="8" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".42" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow5" BlurRadius="35" ShadowDepth="13" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".42" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow1" BlurRadius="5" ShadowDepth="1" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".2" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow2" BlurRadius="8" ShadowDepth="1.5" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".2" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow3" BlurRadius="14" ShadowDepth="4.5" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".2" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow4" BlurRadius="25" ShadowDepth="8" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".2" RenderingBias="Performance" po:Freeze="True" />
<DropShadowEffect x:Key="EffectShadow5" BlurRadius="35" ShadowDepth="13" Direction="270" Color="{StaticResource MaterialDesignShadow}" Opacity=".2" RenderingBias="Performance" po:Freeze="True" />
</ResourceDictionary>
@@ -10,11 +10,12 @@
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"></Setter>
<Setter Property="Padding" Value="{DynamicResource DefaultControlPadding}"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"></Setter>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="IsTabStop" Value="False"></Setter>
</Style>
</ResourceDictionary>
@@ -30,7 +30,7 @@
<Rectangle x:Name="PART_GlowRect" Fill="{StaticResource ProgressBarIndicatorAnimatedFill}" HorizontalAlignment="Left" Margin="-100,0,0,0" Width="100"/>
</Border>
</Decorator>
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource TextIconBrush}" Text="{Binding Value,RelativeSource={RelativeSource FindAncestor,AncestorType=ProgressBar},StringFormat={}{0} %}"></TextBlock>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextIconBrush}" Text="{Binding Value,RelativeSource={RelativeSource FindAncestor,AncestorType=ProgressBar},StringFormat={}{0} %}"></TextBlock>
</Grid>
</Grid>
</Grid>
+2 -1
View File
@@ -10,6 +10,7 @@
<Style BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style x:Key="ButtonPrimary" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
@@ -31,7 +32,6 @@
<Style x:Key="ButtonIconTransparent" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
@@ -53,6 +53,7 @@
<Style x:Key="ButtonIconDefault" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
<Style x:Key="ButtonIconPrimary" BasedOn="{StaticResource ButtonIconBaseStyle}" TargetType="{x:Type Button}">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
@@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ContentControl}">
<Setter Property="Focusable" Value="False"></Setter>
</Style>
</ResourceDictionary>
+10 -10
View File
@@ -39,8 +39,8 @@
<GeometryDrawing>
<GeometryDrawing.Brush>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource PrimaryColor}" Offset="0"/>
<GradientStop Color="{DynamicResource PrimaryColor}" Offset="0.5"/>
<GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0.5"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
@@ -101,8 +101,8 @@
<GeometryDrawing>
<GeometryDrawing.Brush>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource SuccessColor}" Offset="0"/>
<GradientStop Color="{DynamicResource SuccessColor}" Offset="0.5"/>
<GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0.5"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
@@ -131,8 +131,8 @@
<GeometryDrawing>
<GeometryDrawing.Brush>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource InfoColor}" Offset="0"/>
<GradientStop Color="{DynamicResource InfoColor}" Offset="0.5"/>
<GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0.5"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
@@ -161,8 +161,8 @@
<GeometryDrawing>
<GeometryDrawing.Brush>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource WarningColor}" Offset="0"/>
<GradientStop Color="{DynamicResource WarningColor}" Offset="0.5"/>
<GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0.5"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
@@ -191,8 +191,8 @@
<GeometryDrawing>
<GeometryDrawing.Brush>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="{DynamicResource DangerColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DangerColor}" Offset="0.5"/>
<GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0"/>
<GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0.5"/>
<GradientStop Color="White" Offset="0.5"/>
<GradientStop Color="White" Offset="1"/>
</LinearGradientBrush>
+2 -2
View File
@@ -18,7 +18,7 @@
<!--<ResourceDictionary Source="DataGrid.xaml"></ResourceDictionary>-->
<!--<ResourceDictionary Source="GroupBox.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Pagination.xaml"></ResourceDictionary>
<!--<ResourceDictionary Source="TabControl.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="TabControl.xaml"></ResourceDictionary>
<ResourceDictionary Source="ListBox.xaml"></ResourceDictionary>
<!--<ResourceDictionary Source="ComboBox.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Loading.xaml"></ResourceDictionary>
@@ -28,7 +28,7 @@
<!--<ResourceDictionary Source="InfoBrief.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="Expander.xaml"></ResourceDictionary>
<!--<ResourceDictionary Source="TextBox.xaml"></ResourceDictionary>-->
<!--<ResourceDictionary Source="ContentControl.xaml"></ResourceDictionary>-->
<ResourceDictionary Source="ContentControl.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
+107
View File
@@ -0,0 +1,107 @@
<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:interactivity="clr-namespace:HandyControl.Interactivity">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Paths.xaml"></ResourceDictionary>
<ResourceDictionary Source="../Basic/Converters.xaml"></ResourceDictionary>
<ResourceDictionary Source="Button.xaml"></ResourceDictionary>
<ResourceDictionary Source="ToggleButton.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type controls:TabItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="BorderThickness" Value="1,0,1,1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="16,0"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Background="Transparent" Text="{Binding Header,RelativeSource={RelativeSource FindAncestor,AncestorType=controls:TabItem}}"/>
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:TabItem}">
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" BorderThickness="{TemplateBinding BorderThickness}" x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Margin="0">
<Border Margin="0,0,0,-1" x:Name="innerBorder" Background="White" Opacity="0"/>
</Border>
<ContentPresenter Grid.Column="0" x:Name="contentPresenter" ContentSource="Header" Focusable="False" HorizontalAlignment="Stretch" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center">
<ContentPresenter.OpacityMask>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Offset="1"/>
<GradientStop Color="White" Offset="0.8"/>
</LinearGradientBrush>
</ContentPresenter.OpacityMask>
</ContentPresenter>
<Button Grid.Column="1" x:Name="PART_CloseButton" Visibility="{Binding ShowCloseButton,RelativeSource={RelativeSource FindAncestor,AncestorType=controls:TabControl},Converter={StaticResource Boolean2VisibilityConverter}}" Background="Transparent" Style="{StaticResource ButtonOpacityStyle}" Width="28">
<Path Fill="{DynamicResource PrimaryTextBrush}" Width="8" Height="8" Style="{StaticResource ClosePathStyle}"/>
</Button>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Panel.ZIndex" Value="1"/>
<Setter Property="Opacity" TargetName="innerBorder" Value="1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type controls:TabControl}">
<Setter Property="Padding" Value="0"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:TabControl}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="ColumnDefinition0"/>
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
<RowDefinition x:Name="RowDefinition1" Height="*"/>
</Grid.RowDefinitions>
<Border Background="White" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource BorderBrush}">
<controls:TabPanel TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsEnableTabFill="{TemplateBinding IsEnableTabFill}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
<interactivity:Interaction.Behaviors>
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
<interactivity:FluidMoveBehavior.EaseX>
<CubicEase EasingMode="EaseOut"/>
</interactivity:FluidMoveBehavior.EaseX>
</interactivity:FluidMoveBehavior>
</interactivity:Interaction.Behaviors>
</controls:TabPanel>
</Border>
<Border x:Name="contentPanel" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BorderBrush}" Background="White" HorizontalAlignment="Right">
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
</Border>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+1 -1
View File
@@ -37,7 +37,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Visibility="{TemplateBinding IsFullScreen,Converter={StaticResource Boolean2VisibilityFeConverter}}" Background="{TemplateBinding NoUserAreaBackground}" Name="GridMenu" TextElement.Foreground="{TemplateBinding NoUserAreaForeground}">
<Grid Visibility="{TemplateBinding IsFullScreen,Converter={StaticResource Boolean2VisibilityReConverter}}" Background="{TemplateBinding NoUserAreaBackground}" Name="GridMenu" TextElement.Foreground="{TemplateBinding NoUserAreaForeground}">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
+28 -3
View File
@@ -5,15 +5,40 @@ using System.Windows.Controls.Primitives;
namespace HandyControl.Tools
{
public class ArithmeticHelper
/// <summary>
/// 包含内部使用的一些简单算法
/// </summary>
internal class ArithmeticHelper
{
/// <summary>
/// 平分一个整数到一个数组中
/// </summary>
/// <param name="num"></param>
/// <param name="count"></param>
/// <returns></returns>
public static int[] DivideInt2Arr(int num, int count)
{
var arr = new int[count];
var div = num / count;
var rest = num % count;
for (int i = 0; i < count; i++)
{
arr[i] = div;
}
for (int i = 0; i < rest; i++)
{
arr[i] += 1;
}
return arr;
}
/// <summary>
/// 计算控件在窗口中的可见坐标
/// </summary>
/// <param name="element"></param>
/// <param name="showElement"></param>
/// <returns></returns>
internal static Point CalSafePoint(FrameworkElement element, FrameworkElement showElement)
public static Point CalSafePoint(FrameworkElement element, FrameworkElement showElement)
{
if (element == null || showElement == null) return default(Point);
var point = element.PointToScreen(new Point(0, 0));
@@ -33,7 +58,7 @@ namespace HandyControl.Tools
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
internal static Rect GetLayoutRect(FrameworkElement element)
public static Rect GetLayoutRect(FrameworkElement element)
{
var num1 = element.ActualWidth;
var num2 = element.ActualHeight;
@@ -4,7 +4,7 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class Boolean2BooleanFeConverter : IValueConverter
public class Boolean2BooleanReConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -5,7 +5,7 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class Boolean2VisibilityFeConverter : IValueConverter
public class Boolean2VisibilityReConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -1,20 +0,0 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class IsNullConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new InvalidOperationException("IsNullConverter can only be used OneWay.");
}
}
}
@@ -8,12 +8,12 @@ namespace HandyControl.Tools.Converter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null) return "未知大小";
if (value == null) return Properties.Langs.Lang.UnknownSize;
if (value is long intValue)
{
if (intValue < 0)
{
return "未知大小";
return Properties.Langs.Lang.UnknownSize;
}
if (intValue < 1024)
{
@@ -39,9 +39,9 @@ namespace HandyControl.Tools.Converter
{
return $"{intValue / 1125899906842624.0:0.00} PB";
}
return "过大";
return Properties.Langs.Lang.TooLarge;
}
return "未知";
return Properties.Langs.Lang.Unknown;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -5,7 +5,7 @@ using System.Windows.Data;
namespace HandyControl.Tools.Converter
{
public class String2VisibilityFeConverter : IValueConverter
public class String2VisibilityReConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
+11 -10
View File
@@ -1,17 +1,18 @@
using System.Text.RegularExpressions;
using System;
using System.Text.RegularExpressions;
using HandyControl.Data.Enum;
namespace HandyControl.Tools
{
/// <summary>
/// 包含一些正则验证操作
/// 包含一些正则验证操作
/// </summary>
public static class RegularJudgment
{
private static readonly RegularPatterns RegularPatterns = new RegularPatterns();
/// <summary>
/// 判断字符串格式是否符合某种要求
/// 判断字符串格式是否符合某种要求
/// </summary>
/// <param name="str">需要判断的字符串</param>
/// <param name="pattern">正则表达式</param>
@@ -22,7 +23,7 @@ namespace HandyControl.Tools
}
/// <summary>
/// 判断字符串是否满足指定的格式
/// 判断字符串是否满足指定的格式
/// </summary>
/// <param name="text">需要判断的字符串</param>
/// <param name="textType">指定格式的文本</param>
@@ -31,11 +32,11 @@ namespace HandyControl.Tools
{
if (textType == TextType.Common) return true;
return Regex.IsMatch(text,
RegularPatterns.GetValue(System.Enum.GetName(typeof(TextType), textType) + "Pattern").ToString());
RegularPatterns.GetValue(Enum.GetName(typeof(TextType), textType) + "Pattern").ToString());
}
/// <summary>
/// 判断字符串格式是否为电子邮件
/// 判断字符串格式是否为电子邮件
/// </summary>
/// <param name="email">需要判断的Email字符串</param>
/// <returns>方法返回布尔值</returns>
@@ -45,7 +46,7 @@ namespace HandyControl.Tools
}
/// <summary>
/// 判断字符串格式是否为指定类型的IP地址
/// 判断字符串格式是否为指定类型的IP地址
/// </summary>
/// <param name="ip">需要判断的IP字符串</param>
/// <param name="ipType">指定的IP类型</param>
@@ -64,7 +65,7 @@ namespace HandyControl.Tools
}
/// <summary>
/// 判断字符串格式是否为IP地址
/// 判断字符串格式是否为IP地址
/// </summary>
/// <param name="ip">需要判断的IP字符串</param>
/// <returns>方法返回布尔值</returns>
@@ -74,7 +75,7 @@ namespace HandyControl.Tools
}
/// <summary>
/// 判断字符串格式是否为单个汉字
/// 判断字符串格式是否为单个汉字
/// </summary>
/// <param name="str">需要判断的单个汉字字符串</param>
/// <returns>方法返回布尔值</returns>
@@ -84,7 +85,7 @@ namespace HandyControl.Tools
}
/// <summary>
/// 判断字符串格式是否为url
/// 判断字符串格式是否为url
/// </summary>
/// <param name="str">需要判断的url字符串</param>
/// <returns>方法返回布尔值</returns>
+38 -39
View File
@@ -1,24 +1,15 @@
namespace HandyControl.Tools
{
/// <summary>
/// 包含一些正则验证所需要的字符串
/// 包含一些正则验证所需要的字符串
/// </summary>
public sealed class RegularPatterns
{
/// <summary>
///
/// </summary>
/// <param name="propertyName"></param>
/// <returns></returns>
public object GetValue(string propertyName)
{
return GetType().GetField(propertyName).GetValue(null);
}
/// <summary>
/// 邮件正则匹配表达式
/// </summary>
public const string MailPattern = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
public const string MailPattern =
@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
/// <summary>
/// 手机号正则匹配表达式
@@ -26,127 +17,135 @@
public const string PhonePattern = @"^((13[0-9])|(15[^4,\d])|(18[0,5-9]))\d{8}$";
/// <summary>
/// IP正则匹配
/// IP正则匹配
/// </summary>
public const string IpPattern =
@"^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
@"^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$";
/// <summary>
/// A类IP正则匹配
/// A类IP正则匹配
/// </summary>
public const string IpAPattern =
@"^(12[0-6]|1[0-1]\d|[1-9]?\d)\."
@"^(12[0-6]|1[0-1]\d|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$";
/// <summary>
/// B类IP正则匹配
/// B类IP正则匹配
/// </summary>
public const string IpBPattern =
@"^(19[0-1]|12[8-9]|1[3-8]\d)\."
@"^(19[0-1]|12[8-9]|1[3-8]\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$";
/// <summary>
/// C类IP正则匹配
/// C类IP正则匹配
/// </summary>
public const string IpCPattern =
@"^(19[2-9]|22[0-3]|2[0-1]\d)\."
@"^(19[2-9]|22[0-3]|2[0-1]\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$";
/// <summary>
/// D类IP正则匹配
/// D类IP正则匹配
/// </summary>
public const string IpDPattern =
@"^(22[4-9]|23\d\."
@"^(22[4-9]|23\d\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$";
/// <summary>
/// E类IP正则匹配
/// E类IP正则匹配
/// </summary>
public const string IpEPattern =
@"^(25[0-5]|24\d\."
@"^(25[0-5]|24\d\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\."
+ @"(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)$";
/// <summary>
/// 汉字正则匹配
/// 汉字正则匹配
/// </summary>
public const string ChinesePattern = @"^[\u4e00-\u9fa5]$";
/// <summary>
/// Url正则匹配
/// Url正则匹配
/// </summary>
public const string UrlPattern = @"((http|ftp|https)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?";
public const string UrlPattern =
@"((http|ftp|https)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\&%_\./-~-]*)?";
/// <summary>
/// 数字正则匹配
/// 数字正则匹配
/// </summary>
public const string NumberPattern = @"^\d$";
/// <summary>
/// 计算性质数字正则匹配
/// 计算性质数字正则匹配
/// </summary>
public const string DigitsPattern = @"^[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$";
/// <summary>
/// 正整数正则匹配
/// 正整数正则匹配
/// </summary>
public const string PIntPattern = @"^[1-9]\d*$";
/// <summary>
/// 负整数正则匹配
/// 负整数正则匹配
/// </summary>
public const string NIntPattern = @"^-[1-9]\d*$ ";
/// <summary>
/// 整数正则匹配
/// 整数正则匹配
/// </summary>
public const string IntPattern = @"^-?[1-9]\d*$";
/// <summary>
/// 非负整数正则匹配
/// 非负整数正则匹配
/// </summary>
public const string NnIntPattern = @"^[1-9]\d*|0$";
/// <summary>
/// 非正整数正则匹配
/// 非正整数正则匹配
/// </summary>
public const string NpIntPattern = @"^-[1-9]\d*|0$";
/// <summary>
/// 正浮点数正则匹配
/// 正浮点数正则匹配
/// </summary>
public const string PDoublePattern = @"^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$";
/// <summary>
/// 负浮点数正则匹配
/// 负浮点数正则匹配
/// </summary>
public const string NDoublePattern = @"^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$";
/// <summary>
/// 浮点数正则匹配
/// 浮点数正则匹配
/// </summary>
public const string DoublePattern = @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$";
/// <summary>
/// 非负浮点数正则匹配
/// 非负浮点数正则匹配
/// </summary>
public const string NnDoublePattern = @"^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$";
/// <summary>
/// 非正浮点数正则匹配
/// 非正浮点数正则匹配
/// </summary>
public const string NpDoublePattern = @"^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$";
/// <summary>
/// 根据属性名称使用反射来获取值
/// </summary>
/// <param name="propertyName"></param>
/// <returns></returns>
public object GetValue(string propertyName) => GetType().GetField(propertyName).GetValue(null);
}
}
+1 -2
View File
@@ -10,9 +10,8 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Lang/zh-cn.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/ThemesDefault.xaml"/>
<ResourceDictionary Source="Resources/Themes/Style.xaml"/>
<ResourceDictionary Source="Resources/Themes/Styles/Style.xaml"/>
<ResourceDictionary>
<viewModel:ViewModelLocator x:Key="Locator" d:IsDataSource="True"/>
</ResourceDictionary>
+2
View File
@@ -30,5 +30,7 @@
public static readonly string LoadButtonDemoCtl = nameof(LoadButtonDemoCtl);
public static readonly string LoadToggleButtonDemoCtl = nameof(LoadToggleButtonDemoCtl);
public static readonly string LoadTabControlDemoCtl = nameof(LoadTabControlDemoCtl);
}
}
+50 -11
View File
@@ -63,6 +63,16 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Data\MessageToken.cs" />
<Compile Include="Properties\Langs\Lang.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Lang.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Langs\Lang.en.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Lang.en.resx</DependentUpon>
</Compile>
<Compile Include="UserControl\ControlLocator.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -89,6 +99,9 @@
<Compile Include="UserControl\Controls\LoadingDemoCtl.xaml.cs">
<DependentUpon>LoadingDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Main\NoUserContent.xaml.cs">
<DependentUpon>NoUserContent.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Styles\ButtonDemoCtl.xaml.cs">
<DependentUpon>ButtonDemoCtl.xaml</DependentUpon>
</Compile>
@@ -110,6 +123,9 @@
<Compile Include="UserControl\Styles\ProgressBarDemoCtl.xaml.cs">
<DependentUpon>ProgressBarDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Controls\TabControlDemoCtl.xaml.cs">
<DependentUpon>TabControlDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Styles\ToggleButtonDemoCtl.xaml.cs">
<DependentUpon>ToggleButtonDemoCtl.xaml</DependentUpon>
</Compile>
@@ -129,10 +145,6 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Resources\Lang\zh-cn.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Themes\Basic\Brushes.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -141,7 +153,19 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Themes\Style.xaml">
<Page Include="Resources\Themes\Basic\Geometries.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Themes\Styles\Label.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Themes\Styles\Style.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\Themes\Styles\TreeViewItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -173,6 +197,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Main\NoUserContent.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Styles\ButtonDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -201,6 +229,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Controls\TabControlDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Styles\ToggleButtonDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -224,16 +256,10 @@
<Resource Include="Resources\Img\4.jpg" />
<Resource Include="Resources\Img\5.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Img\icon-white.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Img\b1.jpg" />
<Resource Include="Resources\Img\b2.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Window\" />
</ItemGroup>
@@ -246,5 +272,18 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Langs\Lang.en.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Lang.en.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Langs\Lang.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Lang.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+2 -23
View File
@@ -16,29 +16,8 @@
Name="MyWindow"
DataContext="{Binding Main,Source={StaticResource Locator}}"
d:DesignHeight="800"
d:DesignWidth="1400">
<controls:WindowBorderless.NoUserContent>
<StackPanel Orientation="Horizontal">
<Border Margin="10,0,0,0" Width="16" Height="16">
<Border.Background>
<ImageBrush ImageSource="Resources/Img/icon-white.png"/>
</Border.Background>
</Border>
<Menu Margin="10,0,0,0" WindowChrome.IsHitTestVisibleInChrome="True" Background="Transparent">
<MenuItem Foreground="White" Header="File">
<MenuItem Header="New repository" InputGestureText="Ctrl+N"></MenuItem>
<Separator></Separator>
<MenuItem Header="Add local repository"></MenuItem>
<MenuItem Header="Clone repository"></MenuItem>
</MenuItem>
<MenuItem Foreground="White" Header="Edit"></MenuItem>
<MenuItem Foreground="White" Header="View"></MenuItem>
<MenuItem Foreground="White" Header="Repository"></MenuItem>
<MenuItem Foreground="White" Header="Branch"></MenuItem>
<MenuItem Foreground="White" Header="Help"></MenuItem>
</Menu>
</StackPanel>
</controls:WindowBorderless.NoUserContent>
d:DesignWidth="1400"
NoUserContent="{Binding NoUserContent}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" MinWidth="200" MaxWidth="400"/>
+2 -2
View File
@@ -12,5 +12,5 @@ using System.Windows;
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
+360
View File
@@ -0,0 +1,360 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace HandyControlDemo.Properties.Langs {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Lang {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Lang() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HandyControlDemo.Properties.Langs.Lang", typeof(Lang).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找类似 动画路径 的本地化字符串。
/// </summary>
public static string AnimationPath {
get {
return ResourceManager.GetString("AnimationPath", resourceCulture);
}
}
/// <summary>
/// 查找类似 按钮 的本地化字符串。
/// </summary>
public static string Button {
get {
return ResourceManager.GetString("Button", resourceCulture);
}
}
/// <summary>
/// 查找类似 透明按钮 的本地化字符串。
/// </summary>
public static string ButtonOpacity {
get {
return ResourceManager.GetString("ButtonOpacity", resourceCulture);
}
}
/// <summary>
/// 查找类似 轮播 的本地化字符串。
/// </summary>
public static string Carousel {
get {
return ResourceManager.GetString("Carousel", resourceCulture);
}
}
/// <summary>
/// 查找类似 复选框 的本地化字符串。
/// </summary>
public static string CheckBox {
get {
return ResourceManager.GetString("CheckBox", resourceCulture);
}
}
/// <summary>
/// 查找类似 颜色拾取器 的本地化字符串。
/// </summary>
public static string ColorPicker {
get {
return ResourceManager.GetString("ColorPicker", resourceCulture);
}
}
/// <summary>
/// 查找类似 对比滑块 的本地化字符串。
/// </summary>
public static string CompareSlider {
get {
return ResourceManager.GetString("CompareSlider", resourceCulture);
}
}
/// <summary>
/// 查找类似 控件 的本地化字符串。
/// </summary>
public static string Controls {
get {
return ResourceManager.GetString("Controls", resourceCulture);
}
}
/// <summary>
/// 查找类似 危险 的本地化字符串。
/// </summary>
public static string Danger {
get {
return ResourceManager.GetString("Danger", resourceCulture);
}
}
/// <summary>
/// 查找类似 默认 的本地化字符串。
/// </summary>
public static string Default {
get {
return ResourceManager.GetString("Default", resourceCulture);
}
}
/// <summary>
/// 查找类似 展开框 的本地化字符串。
/// </summary>
public static string Expander {
get {
return ResourceManager.GetString("Expander", resourceCulture);
}
}
/// <summary>
/// 查找类似 信息通知 的本地化字符串。
/// </summary>
public static string Growl {
get {
return ResourceManager.GetString("Growl", resourceCulture);
}
}
/// <summary>
/// 查找类似 检测到有新版本! 的本地化字符串。
/// </summary>
public static string GrowlAsk {
get {
return ResourceManager.GetString("GrowlAsk", resourceCulture);
}
}
/// <summary>
/// 查找类似 连接失败,请检查网络! 的本地化字符串。
/// </summary>
public static string GrowlError {
get {
return ResourceManager.GetString("GrowlError", resourceCulture);
}
}
/// <summary>
/// 查找类似 程序已崩溃~~~ 的本地化字符串。
/// </summary>
public static string GrowlFatal {
get {
return ResourceManager.GetString("GrowlFatal", resourceCulture);
}
}
/// <summary>
/// 查找类似 今天的天气不错~~~ 的本地化字符串。
/// </summary>
public static string GrowlInfo {
get {
return ResourceManager.GetString("GrowlInfo", resourceCulture);
}
}
/// <summary>
/// 查找类似 文件保存成功! 的本地化字符串。
/// </summary>
public static string GrowlSuccess {
get {
return ResourceManager.GetString("GrowlSuccess", resourceCulture);
}
}
/// <summary>
/// 查找类似 磁盘空间快要满了! 的本地化字符串。
/// </summary>
public static string GrowlWarning {
get {
return ResourceManager.GetString("GrowlWarning", resourceCulture);
}
}
/// <summary>
/// 查找类似 图片浏览器 的本地化字符串。
/// </summary>
public static string ImageBrowser {
get {
return ResourceManager.GetString("ImageBrowser", resourceCulture);
}
}
/// <summary>
/// 查找类似 信息 的本地化字符串。
/// </summary>
public static string Info {
get {
return ResourceManager.GetString("Info", resourceCulture);
}
}
/// <summary>
/// 查找类似 加载条 的本地化字符串。
/// </summary>
public static string Loading {
get {
return ResourceManager.GetString("Loading", resourceCulture);
}
}
/// <summary>
/// 查找类似 点击打开图片浏览器 的本地化字符串。
/// </summary>
public static string OpenImageBrowser {
get {
return ResourceManager.GetString("OpenImageBrowser", resourceCulture);
}
}
/// <summary>
/// 查找类似 页码条 的本地化字符串。
/// </summary>
public static string Pagination {
get {
return ResourceManager.GetString("Pagination", resourceCulture);
}
}
/// <summary>
/// 查找类似 主要 的本地化字符串。
/// </summary>
public static string Primary {
get {
return ResourceManager.GetString("Primary", resourceCulture);
}
}
/// <summary>
/// 查找类似 进度条 的本地化字符串。
/// </summary>
public static string ProgressBar {
get {
return ResourceManager.GetString("ProgressBar", resourceCulture);
}
}
/// <summary>
/// 查找类似 样式模板 的本地化字符串。
/// </summary>
public static string Styles {
get {
return ResourceManager.GetString("Styles", resourceCulture);
}
}
/// <summary>
/// 查找类似 成功 的本地化字符串。
/// </summary>
public static string Success {
get {
return ResourceManager.GetString("Success", resourceCulture);
}
}
/// <summary>
/// 查找类似 选项卡控件 的本地化字符串。
/// </summary>
public static string TabControl {
get {
return ResourceManager.GetString("TabControl", resourceCulture);
}
}
/// <summary>
/// 查找类似 文本块 的本地化字符串。
/// </summary>
public static string TextBlock {
get {
return ResourceManager.GetString("TextBlock", resourceCulture);
}
}
/// <summary>
/// 查找类似 时间条 的本地化字符串。
/// </summary>
public static string TimeBar {
get {
return ResourceManager.GetString("TimeBar", resourceCulture);
}
}
/// <summary>
/// 查找类似 标题 的本地化字符串。
/// </summary>
public static string Title {
get {
return ResourceManager.GetString("Title", resourceCulture);
}
}
/// <summary>
/// 查找类似 切换按钮 的本地化字符串。
/// </summary>
public static string ToggleButton {
get {
return ResourceManager.GetString("ToggleButton", resourceCulture);
}
}
/// <summary>
/// 查找类似 警告 的本地化字符串。
/// </summary>
public static string Warning {
get {
return ResourceManager.GetString("Warning", resourceCulture);
}
}
}
}
Whitespace-only changes.
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Controls" xml:space="preserve">
<value>Controls</value>
</data>
<data name="Styles" xml:space="preserve">
<value>Styles</value>
</data>
<data name="Growl" xml:space="preserve">
<value>Growl</value>
</data>
<data name="GrowlInfo" xml:space="preserve">
<value>It's a nice day today~~~</value>
</data>
<data name="GrowlSuccess" xml:space="preserve">
<value>File saved successfully!</value>
</data>
<data name="GrowlWarning" xml:space="preserve">
<value>Disk space is running out!</value>
</data>
<data name="GrowlError" xml:space="preserve">
<value>Connection failed. please check your network!</value>
</data>
<data name="GrowlFatal" xml:space="preserve">
<value>The program has crashed~~~</value>
</data>
<data name="GrowlAsk" xml:space="preserve">
<value>A new version has been detected!</value>
</data>
<data name="Loading" xml:space="preserve">
<value>Loading</value>
</data>
<data name="ImageBrowser" xml:space="preserve">
<value>ImageBrowser</value>
</data>
<data name="ColorPicker" xml:space="preserve">
<value>ColorPicker</value>
</data>
<data name="Carousel" xml:space="preserve">
<value>Carousel</value>
</data>
<data name="CompareSlider" xml:space="preserve">
<value>CompareSlider</value>
</data>
<data name="TimeBar" xml:space="preserve">
<value>TimeBar</value>
</data>
<data name="Expander" xml:space="preserve">
<value>Expander</value>
</data>
<data name="Pagination" xml:space="preserve">
<value>Pagination</value>
</data>
<data name="OpenImageBrowser" xml:space="preserve">
<value>Click to open image browser </value>
</data>
<data name="ProgressBar" xml:space="preserve">
<value>ProgressBar</value>
</data>
<data name="AnimationPath" xml:space="preserve">
<value>AnimationPath</value>
</data>
<data name="Button" xml:space="preserve">
<value>Button</value>
</data>
<data name="ToggleButton" xml:space="preserve">
<value>ToggleButton</value>
</data>
<data name="TabControl" xml:space="preserve">
<value>TabControl</value>
</data>
<data name="CheckBox" xml:space="preserve">
<value>CheckBox</value>
</data>
<data name="TextBlock" xml:space="preserve">
<value>TextBlock</value>
</data>
<data name="Default" xml:space="preserve">
<value>Default</value>
</data>
<data name="Primary" xml:space="preserve">
<value>Primary</value>
</data>
<data name="Success" xml:space="preserve">
<value>Success</value>
</data>
<data name="Info" xml:space="preserve">
<value>Info</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Warning</value>
</data>
<data name="Danger" xml:space="preserve">
<value>Danger</value>
</data>
<data name="ButtonOpacity" xml:space="preserve">
<value>Opacity button</value>
</data>
<data name="Title" xml:space="preserve">
<value>Title</value>
</data>
</root>
+199
View File
@@ -0,0 +1,199 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Controls" xml:space="preserve">
<value>控件</value>
</data>
<data name="Styles" xml:space="preserve">
<value>样式模板</value>
</data>
<data name="Growl" xml:space="preserve">
<value>信息通知</value>
</data>
<data name="GrowlInfo" xml:space="preserve">
<value>今天的天气不错~~~</value>
</data>
<data name="GrowlSuccess" xml:space="preserve">
<value>文件保存成功!</value>
</data>
<data name="GrowlWarning" xml:space="preserve">
<value>磁盘空间快要满了!</value>
</data>
<data name="GrowlError" xml:space="preserve">
<value>连接失败,请检查网络!</value>
</data>
<data name="GrowlFatal" xml:space="preserve">
<value>程序已崩溃~~~</value>
</data>
<data name="GrowlAsk" xml:space="preserve">
<value>检测到有新版本!</value>
</data>
<data name="Loading" xml:space="preserve">
<value>加载条</value>
</data>
<data name="ImageBrowser" xml:space="preserve">
<value>图片浏览器</value>
</data>
<data name="ColorPicker" xml:space="preserve">
<value>颜色拾取器</value>
</data>
<data name="Carousel" xml:space="preserve">
<value>轮播</value>
</data>
<data name="CompareSlider" xml:space="preserve">
<value>对比滑块</value>
</data>
<data name="TimeBar" xml:space="preserve">
<value>时间条</value>
</data>
<data name="Expander" xml:space="preserve">
<value>展开框</value>
</data>
<data name="Pagination" xml:space="preserve">
<value>页码条</value>
</data>
<data name="OpenImageBrowser" xml:space="preserve">
<value>点击打开图片浏览器</value>
</data>
<data name="ProgressBar" xml:space="preserve">
<value>进度条</value>
</data>
<data name="AnimationPath" xml:space="preserve">
<value>动画路径</value>
</data>
<data name="Button" xml:space="preserve">
<value>按钮</value>
</data>
<data name="ToggleButton" xml:space="preserve">
<value>切换按钮</value>
</data>
<data name="TabControl" xml:space="preserve">
<value>选项卡控件</value>
</data>
<data name="CheckBox" xml:space="preserve">
<value>复选框</value>
</data>
<data name="TextBlock" xml:space="preserve">
<value>文本块</value>
</data>
<data name="Default" xml:space="preserve">
<value>默认</value>
</data>
<data name="Primary" xml:space="preserve">
<value>主要</value>
</data>
<data name="Success" xml:space="preserve">
<value>成功</value>
</data>
<data name="Info" xml:space="preserve">
<value>信息</value>
</data>
<data name="Warning" xml:space="preserve">
<value>警告</value>
</data>
<data name="Danger" xml:space="preserve">
<value>危险</value>
</data>
<data name="ButtonOpacity" xml:space="preserve">
<value>透明按钮</value>
</data>
<data name="Title" xml:space="preserve">
<value>标题</value>
</data>
</root>
@@ -1,28 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="Controls">控件</system:String>
<system:String x:Key="Styles">样式模板</system:String>
<system:String x:Key="Growl">信息通知</system:String>
<system:String x:Key="GrowlInfo">今天的天气不错~~~</system:String>
<system:String x:Key="GrowlSuccess">文件保存成功!</system:String>
<system:String x:Key="GrowlWarning">磁盘空间快要满了!</system:String>
<system:String x:Key="GrowlError">连接服务器失败,请检查网络!</system:String>
<system:String x:Key="GrowlFatal">程序已崩溃~~~</system:String>
<system:String x:Key="GrowlAsk">检测到有新版本,是否更新?</system:String>
<system:String x:Key="Loading">加载条</system:String>
<system:String x:Key="ImageBrowser">图片浏览器</system:String>
<system:String x:Key="ColorPicker">颜色拾取器</system:String>
<system:String x:Key="Carousel">轮播</system:String>
<system:String x:Key="CompareSlider">对比滑块</system:String>
<system:String x:Key="TimeBar">时间条</system:String>
<system:String x:Key="Expander">展开框</system:String>
<system:String x:Key="Pagination">页码条</system:String>
<system:String x:Key="OpenImageBrowser">点击打开图片浏览器</system:String>
<system:String x:Key="ProgressBar">进度条</system:String>
<system:String x:Key="AnimationPath">动画路径</system:String>
<system:String x:Key="Button">按钮</system:String>
<system:String x:Key="ToggleButton">切换按钮</system:String>
</ResourceDictionary>
@@ -0,0 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Geometry x:Key="NewGeometry">M512 0h1216a512 512 0 1 1 0 1024H512A512 512 0 1 1 512 0zM420.16 311.04V768h74.88V433.92h2.56l228.48 334.08h72.96V311.04h-75.52v329.6h-2.56l-225.92-329.6h-74.88z m468.48 0V768h340.48v-64h-265.6V565.76h239.36v-64h-239.36V375.04h254.72v-64h-329.6z m369.28 0l131.2 456.96h80l89.6-343.68h2.56l88.96 343.68h79.36l131.84-456.96h-84.48l-85.76 347.52h-2.56l-90.24-347.52h-77.44l-90.24 347.52h-2.56l-85.76-347.52h-84.48z</Geometry>
<Geometry x:Key="LogoGeometry">M40.493382,19.001303 C36.637875,19.06448 33.938568,21.421986 33.948524,25.271919 L34.068279,71.56765 34.066906,71.598007 34.068745,71.747833 34.18895,118.21758 C34.202225,123.35083 39.026951,129.19344 44.965271,131.2674 50.903587,133.34137 55.706783,130.86133 55.693504,125.72808 L55.589508,85.524513 93.866371,85.524513 93.950943,118.21758 C93.964218,123.35083 98.788948,129.19344 104.72726,131.2674 110.66558,133.34137 115.46878,130.86133 115.4555,125.72808 L115.33575,79.432381 115.33712,79.401993 115.33528,79.252007 115.21507,32.782413 C115.2018,27.64917 110.37708,21.806566 104.43876,19.732603 98.500435,17.658638 93.697243,20.138674 93.710518,25.271919 L93.814514,65.475487 55.537647,65.475487 55.453079,32.782413 C55.439804,27.64917 50.615082,21.806566 44.676762,19.732603 43.192181,19.214111 41.778549,18.980244 40.493382,19.001303 z M9.999999,0 L140,0 C145.52284,0 150,4.4771523 150,9.999999 L150,140 C150,145.52284 145.52284,150 140,150 L9.999999,150 C4.4771523,150 0,145.52284 0,140 L0,9.999999 C0,4.4771523 4.4771523,0 9.999999,0 z</Geometry>
</ResourceDictionary>
@@ -0,0 +1,19 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="LabelInfo" TargetType="{x:Type Label}">
<Setter Property="Margin" Value="0,32,16,0"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
<Border CornerRadius="4" Background="{TemplateBinding Background}">
<TextBlock Foreground="White" Margin="10,6" Text="{TemplateBinding Content}"></TextBlock>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -0,0 +1,10 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Brushes.xaml"/>
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
<ResourceDictionary Source="TreeViewItem.xaml"/>
<ResourceDictionary Source="Label.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
@@ -0,0 +1,21 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="TreeViewItemNew" BasedOn="{StaticResource {x:Type TreeViewItem}}" TargetType="{x:Type TreeViewItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Header,RelativeSource={RelativeSource FindAncestor,AncestorType=TreeViewItem}}"></TextBlock>
<Path VerticalAlignment="Center" Data="{StaticResource NewGeometry}" Stretch="Uniform" Margin="10,0,0,0" Width="30" Height="14" Fill="{DynamicResource DangerBrush}"/>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -13,6 +13,7 @@ namespace HandyControlDemo.UserControl
{
SimpleIoc.Default.Register<MainContent>();
SimpleIoc.Default.Register<LeftMainContent>();
SimpleIoc.Default.Register<NoUserContent>();
SimpleIoc.Default.Register<GrowlDemoCtl>();
SimpleIoc.Default.Register<LoadingDemoCtl>();
SimpleIoc.Default.Register<ImageBrowserDemoCtl>();
@@ -26,6 +27,7 @@ namespace HandyControlDemo.UserControl
SimpleIoc.Default.Register<ToggleButtonDemoCtl>();
SimpleIoc.Default.Register<ExpanderDemoCtl>();
SimpleIoc.Default.Register<ProgressBarDemoCtl>();
SimpleIoc.Default.Register<TabControlDemoCtl>();
}
public static ControlLocator Instance => new Lazy<ControlLocator>(() => new ControlLocator()).Value;
@@ -36,6 +38,8 @@ namespace HandyControlDemo.UserControl
public LeftMainContent LeftMainContent => ServiceLocator.Current.GetInstance<LeftMainContent>();
public NoUserContent NoUserContent => ServiceLocator.Current.GetInstance<NoUserContent>();
#endregion
#region Controls
@@ -70,6 +74,8 @@ namespace HandyControlDemo.UserControl
public ProgressBarDemoCtl ProgressBarDemoCtl => new ProgressBarDemoCtl();
public TabControlDemoCtl TabControlDemoCtl => new TabControlDemoCtl();
#endregion
}
}
@@ -5,7 +5,8 @@
var singleList = new List<string>
{
"MainContent",
"LeftMainContent"
"LeftMainContent",
"NoUserContent"
};
var controlList = new List<string>
{
@@ -24,7 +25,8 @@ var styleList = new List<string>
"ButtonDemoCtl",
"ToggleButtonDemoCtl",
"ExpanderDemoCtl",
"ProgressBarDemoCtl"
"ProgressBarDemoCtl",
"TabControlDemoCtl"
};
#>
using System;
@@ -6,13 +6,13 @@
Background="White">
<controls:TransitioningContentControl>
<WrapPanel Margin="32">
<Button Command="{Binding InfoCmd}" Content="Info" Margin="0,5,5,5" Style="{StaticResource ButtonPrimary}"></Button>
<Button Command="{Binding InfoCmd}" Content="Info" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"></Button>
<Button Command="{Binding SuccessCmd}" Content="Success" Margin="5" Style="{StaticResource ButtonSuccess}"></Button>
<Button Command="{Binding WarningCmd}" Content="Warning" Margin="5" Style="{StaticResource ButtonWarning}"></Button>
<Button Command="{Binding ErrorCmd}" Content="Error" Margin="5" Style="{StaticResource ButtonDanger}"></Button>
<Button Command="{Binding AskCmd}" Content="Ask" Margin="5" Background="BlueViolet" Foreground="White"></Button>
<Button Command="{Binding FatalCmd}" Content="Fatal" Margin="5,0"></Button>
<Button Command="{Binding ClearCmd}" Content="Clear" Margin="5,0,0,0"></Button>
<Button Command="{Binding ClearCmd}" Content="Clear" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"></Button>
</WrapPanel>
</controls:TransitioningContentControl>
</UserControl>
@@ -2,9 +2,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="White"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding ImageBrowserDemo,Source={StaticResource Locator}}"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
<controls:TransitioningContentControl>
<Button Command="{Binding OpenImgCmd}" Content="{StaticResource OpenImageBrowser}" Style="{StaticResource ButtonPrimary}" Margin="32"></Button>
<Button Command="{Binding OpenImgCmd}" Content="{x:Static langs:Lang.OpenImageBrowser}" Style="{StaticResource ButtonPrimary}" Margin="32"></Button>
</controls:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,65 @@
<UserControl x:Class="HandyControlDemo.UserControl.TabControlDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="White"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
<controls:TransitioningContentControl>
<controls:ScrollViewer HorizontalScrollBarVisibility="Auto">
<StackPanel>
<Label Style="{StaticResource LabelInfo}" Content="Default" Margin="32,32,0,0"/>
<controls:TabControl Margin="32,16,32,0" Width="800" Height="300">
<controls:TabItem Header="TabItem1">
<Grid Background="White"/>
</controls:TabItem>
<controls:TabItem Header="TabItem2">
<Grid Background="{StaticResource DarkDangerBrush}"/>
</controls:TabItem>
<controls:TabItem Header="TabItem3" IsSelected="True">
<Grid Background="{StaticResource PrimaryBrush}"/>
</controls:TabItem>
<controls:TabItem Header="TabItem4">
<Grid Background="{StaticResource DarkInfoBrush}"/>
</controls:TabItem>
<controls:TabItem Header="TabItem5">
<Grid Background="{StaticResource DarkSuccessBrush}"/>
</controls:TabItem>
<controls:TabItem Header="TabItem6">
<Grid Background="{StaticResource DarkWarningBrush}"/>
</controls:TabItem>
<controls:TabItem Header="TabItem7">
<Grid Background="{StaticResource DarkAccentBrush}"/>
</controls:TabItem>
</controls:TabControl>
<StackPanel Orientation="Horizontal" Margin="32,32,32,16">
<Label Style="{StaticResource LabelInfo}" Margin="0" Content="IsEnableTabFill = True"/>
<Label Style="{StaticResource LabelInfo}" Margin="16,0,0,0" Content="ShowCloseButton = True"/>
<Label Style="{StaticResource LabelInfo}" Margin="16,0,0,0" Content="IsDraggable = True"/>
<Label Style="{StaticResource LabelInfo}" Margin="16,0,0,0" Content="IsEnableAnimation = True"/>
</StackPanel>
<controls:TabControl IsEnableAnimation="True" ShowCloseButton="True" IsDraggable="True" IsEnableTabFill="True" Margin="32,0,32,32" Width="800" Height="300">
<controls:TabItem Header="TabItem1">
<Grid Background="White"/>
</controls:TabItem>
<controls:TabItem IsSelected="True" Header="TabItem2">
<Grid Background="#FFE8563F"/>
</controls:TabItem>
<controls:TabItem Header="TabItem3">
<Grid Background="#FF3F4EE8"/>
</controls:TabItem>
<controls:TabItem Header="TabItem4">
<Grid Background="#FFE83F6D"/>
</controls:TabItem>
<controls:TabItem Header="TabItem5">
<Grid Background="#FFB23FE8"/>
</controls:TabItem>
<controls:TabItem Header="TabItem6">
<Grid Background="#FF3FE8E8"/>
</controls:TabItem>
<controls:TabItem Header="TabItem7">
<Grid Background="#FFE8E03F"/>
</controls:TabItem>
</controls:TabControl>
</StackPanel>
</controls:ScrollViewer>
</controls:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,14 @@
// ReSharper disable once CheckNamespace
namespace HandyControlDemo.UserControl
{
/// <summary>
/// TabControlDemoCtl.xaml 的交互逻辑
/// </summary>
public partial class TabControlDemoCtl
{
public TabControlDemoCtl()
{
InitializeComponent();
}
}
}
@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:data="clr-namespace:HandyControlDemo.Data"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<TreeView controls:ScrollViewer.IsEnableInertia="True" BorderThickness="0">
<i:Interaction.Triggers>
@@ -12,22 +13,23 @@
<command:EventToCommand Command="{Binding SwitchDemoCmd}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
<TreeViewItem IsExpanded="True" Header="{StaticResource Styles}">
<TreeViewItem Tag="{x:Static data:MessageToken.LoadButtonDemoCtl}" Header="{StaticResource Button}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadToggleButtonDemoCtl}" Header="{StaticResource ToggleButton}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadExpanderDemoCtl}" Header="{StaticResource Expander}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadProgressBarDemoCtl}" Header="{StaticResource ProgressBar}"/>
<TreeViewItem IsExpanded="True" Header="{x:Static langs:Lang.Styles}">
<TreeViewItem Tag="{x:Static data:MessageToken.LoadButtonDemoCtl}" Header="{x:Static langs:Lang.Button}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadToggleButtonDemoCtl}" Header="{x:Static langs:Lang.ToggleButton}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadExpanderDemoCtl}" Header="{x:Static langs:Lang.Expander}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadProgressBarDemoCtl}" Header="{x:Static langs:Lang.ProgressBar}"/>
</TreeViewItem>
<TreeViewItem IsExpanded="True" Header="{StaticResource Controls}">
<TreeViewItem Tag="{x:Static data:MessageToken.LoadGrowlDemoCtl}" Header="{StaticResource Growl}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadLoadingDemoCtl}" Header="{StaticResource Loading}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadImageBrowserDemoCtl}" Header="{StaticResource ImageBrowser}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadColorPickerDemoCtl}" Header="{StaticResource ColorPicker}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadCarouselDemoCtl}" Header="{StaticResource Carousel}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadCompareSliderDemoCtl}" Header="{StaticResource CompareSlider}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadTimeBarDemoCtl}" Header="{StaticResource TimeBar}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadPaginationDemoCtl}" Header="{StaticResource Pagination}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadAnimationPathDemoCtl}" Header="{StaticResource AnimationPath}"/>
<TreeViewItem IsExpanded="True" Header="{x:Static langs:Lang.Controls}">
<TreeViewItem Tag="{x:Static data:MessageToken.LoadGrowlDemoCtl}" Header="{x:Static langs:Lang.Growl}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadLoadingDemoCtl}" Header="{x:Static langs:Lang.Loading}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadImageBrowserDemoCtl}" Header="{x:Static langs:Lang.ImageBrowser}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadColorPickerDemoCtl}" Header="{x:Static langs:Lang.ColorPicker}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadCarouselDemoCtl}" Header="{x:Static langs:Lang.Carousel}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadCompareSliderDemoCtl}" Header="{x:Static langs:Lang.CompareSlider}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadTimeBarDemoCtl}" Header="{x:Static langs:Lang.TimeBar}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadPaginationDemoCtl}" Header="{x:Static langs:Lang.Pagination}"/>
<TreeViewItem Tag="{x:Static data:MessageToken.LoadAnimationPathDemoCtl}" Header="{x:Static langs:Lang.AnimationPath}"/>
<TreeViewItem Style="{StaticResource TreeViewItemNew}" Tag="{x:Static data:MessageToken.LoadTabControlDemoCtl}" Header="{x:Static langs:Lang.TabControl}"/>
</TreeViewItem>
</TreeView>
</Border>
@@ -3,13 +3,13 @@
x:Class="HandyControlDemo.UserControl.MainContent"
Background="#f0f0f0">
<Border Background="{StaticResource MainContentBackground}">
<Grid Name="GridMain" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="16,0,16,16">
<Grid Name="GridMain" MinHeight="300" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Name="BorderEffect" Grid.RowSpan="2" Background="White" CornerRadius="0,0,10,10" Effect="{StaticResource EffectShadow4}"></Border>
<Border Height="32" Name="BorderTitle" Grid.Row="0" Background="{StaticResource PrimaryBrush}">
<Border Name="BorderEffect" Grid.RowSpan="2" Background="White" CornerRadius="10" Effect="{StaticResource EffectShadow4}"></Border>
<Border Height="32" Name="BorderTitle" Grid.Row="0" CornerRadius="10,10,0,0" Background="{StaticResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockDefault}" Foreground="White" Text="{Binding ContentTitle}"></TextBlock>
</Border>
<Border Grid.Row="1" ClipToBounds="True">
@@ -0,0 +1,30 @@
<StackPanel x:Class="HandyControlDemo.UserControl.NoUserContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
Orientation="Horizontal">
<Button WindowChrome.IsHitTestVisibleInChrome="True" Width="28" Height="28" Style="{StaticResource ButtonOpacityStyle}">
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="Click">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.ShowSystemMenuCommand}" />
</interactivity:EventTrigger>
<interactivity:EventTrigger EventName="MouseDoubleClick">
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.CloseWindowCommand}" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
<Path Height="16" Fill="White" Stretch="Uniform" Data="{StaticResource LogoGeometry}"/>
</Button>
<Menu Margin="10,0,0,0" WindowChrome.IsHitTestVisibleInChrome="True" Background="Transparent">
<MenuItem Foreground="White" Header="File">
<MenuItem Header="New repository" InputGestureText="Ctrl+N"></MenuItem>
<Separator></Separator>
<MenuItem Header="Add local repository"></MenuItem>
<MenuItem Header="Clone repository"></MenuItem>
</MenuItem>
<MenuItem Foreground="White" Header="Edit"></MenuItem>
<MenuItem Foreground="White" Header="View"></MenuItem>
<MenuItem Foreground="White" Header="Repository"></MenuItem>
<MenuItem Foreground="White" Header="Branch"></MenuItem>
<MenuItem Foreground="White" Header="Help"></MenuItem>
</Menu>
</StackPanel>
@@ -0,0 +1,14 @@
// ReSharper disable once CheckNamespace
namespace HandyControlDemo.UserControl
{
/// <summary>
/// NoUserContent.xaml 的交互逻辑
/// </summary>
public partial class NoUserContent
{
public NoUserContent()
{
InitializeComponent();
}
}
}
@@ -2,38 +2,39 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
Background="White">
<controls:TransitioningContentControl>
<controls:ScrollViewer IsEnableInertia="True">
<StackPanel Margin="32">
<WrapPanel ItemWidth="160" ItemHeight="130">
<StackPanel>
<Button Content="默认" Margin="5"></Button>
<Button IsEnabled="False" Content="默认" Margin="5"></Button>
<Button Content="{x:Static langs:Lang.Default}" Margin="5"></Button>
<Button IsEnabled="False" Content="{x:Static langs:Lang.Default}" Margin="5"></Button>
</StackPanel>
<StackPanel>
<Button Content="主要" Margin="5" Style="{StaticResource ButtonPrimary}"></Button>
<Button IsEnabled="False" Content="主要" Margin="5" Style="{StaticResource ButtonPrimary}"></Button>
<Button Content="{x:Static langs:Lang.Primary}" Margin="5" Style="{StaticResource ButtonPrimary}"></Button>
<Button IsEnabled="False" Content="{x:Static langs:Lang.Primary}" Margin="5" Style="{StaticResource ButtonPrimary}"></Button>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ButtonPrimary"></TextBlock>
</StackPanel>
<StackPanel>
<Button Content="成功" Margin="5" Style="{StaticResource ButtonSuccess}"></Button>
<Button IsEnabled="False" Content="成功" Margin="5" Style="{StaticResource ButtonSuccess}"></Button>
<Button Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"></Button>
<Button IsEnabled="False" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"></Button>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ButtonSuccess"></TextBlock>
</StackPanel>
<StackPanel>
<Button Content="信息" Margin="5" Style="{StaticResource ButtonInfo}"></Button>
<Button IsEnabled="False" Content="信息" Margin="5" Style="{StaticResource ButtonInfo}"></Button>
<Button Content="{x:Static langs:Lang.Info}" Margin="5" Style="{StaticResource ButtonInfo}"></Button>
<Button IsEnabled="False" Content="{x:Static langs:Lang.Info}" Margin="5" Style="{StaticResource ButtonInfo}"></Button>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ButtonInfo"></TextBlock>
</StackPanel>
<StackPanel>
<Button Content="警告" Margin="5" Style="{StaticResource ButtonWarning}"></Button>
<Button IsEnabled="False" Content="警告" Margin="5" Style="{StaticResource ButtonWarning}"></Button>
<Button Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"></Button>
<Button IsEnabled="False" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"></Button>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ButtonWarning"></TextBlock>
</StackPanel>
<StackPanel>
<Button Content="危险" Margin="5" Style="{StaticResource ButtonDanger}"></Button>
<Button IsEnabled="False" Content="危险" Margin="5" Style="{StaticResource ButtonDanger}"></Button>
<Button Content="{x:Static langs:Lang.Danger}" Margin="5" Style="{StaticResource ButtonDanger}"></Button>
<Button IsEnabled="False" Content="{x:Static langs:Lang.Danger}" Margin="5" Style="{StaticResource ButtonDanger}"></Button>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ButtonDanger"></TextBlock>
</StackPanel>
</WrapPanel>
@@ -69,7 +70,7 @@
<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="Wrap" Style="{StaticResource TextBlockDefault}" Text="ButtonIconPrimary(DeleteGeometry)"></TextBlock>
</StackPanel>
<StackPanel>
<Button Margin="5" Height="28" Padding="10,0" Background="#24292e" Foreground="White" Content="透明按钮" Style="{StaticResource ButtonOpacityStyle}" controls:BackgroundSwitchElement.MouseHoverBackground="Red" controls:BackgroundSwitchElement.MouseDownBackground="PaleVioletRed"></Button>
<Button Margin="5" Height="28" Padding="10,0" Background="#24292e" Foreground="White" Content="{x:Static langs:Lang.ButtonOpacity}" Style="{StaticResource ButtonOpacityStyle}" controls:BackgroundSwitchElement.MouseHoverBackground="Red" controls:BackgroundSwitchElement.MouseDownBackground="PaleVioletRed"></Button>
<TextBlock TextTrimming="CharacterEllipsis" TextWrapping="Wrap" Style="{StaticResource TextBlockDefault}" Text="ButtonOpacityStyle"></TextBlock>
</StackPanel>
</WrapPanel>
@@ -2,19 +2,20 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="White"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
<controls:TransitioningContentControl>
<StackPanel Margin="32">
<Expander Header="标题1" BorderThickness="1,1,1,0" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Border Height="100" Background="{StaticResource BackgroundBrush}"></Border>
</Expander>
<Expander Header="标题1" BorderThickness="1,1,1,0" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Border Height="100" Background="{StaticResource BackgroundBrush}"></Border>
</Expander>
<Expander Header="标题1" BorderThickness="1,1,1,0" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1,1,1,0" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Border Height="100" Background="{StaticResource BackgroundBrush}"></Border>
</Expander>
<Expander Header="标题1" BorderThickness="1" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Expander Header="{x:Static langs:Lang.Title}" BorderThickness="1" BorderBrush="{StaticResource BorderBrush}" Width="240" HorizontalAlignment="Left">
<Border Height="100" Background="{StaticResource BackgroundBrush}"></Border>
</Expander>
</StackPanel>
@@ -2,37 +2,38 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="White"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
<controls:TransitioningContentControl>
<controls:ScrollViewer IsEnableInertia="True">
<WrapPanel Margin="32" ItemWidth="160" ItemHeight="130">
<StackPanel>
<ToggleButton IsChecked="True" Content="默认" Margin="5"></ToggleButton>
<ToggleButton IsEnabled="False" Content="默认" Margin="5"></ToggleButton>
<ToggleButton IsChecked="True" Content="{x:Static langs:Lang.Default}" Margin="5"></ToggleButton>
<ToggleButton IsEnabled="False" Content="{x:Static langs:Lang.Default}" Margin="5"></ToggleButton>
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True" Content="主要" Margin="5" Style="{StaticResource ToggleButtonPrimary}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="主要" Margin="5" Style="{StaticResource ToggleButtonPrimary}"></ToggleButton>
<ToggleButton IsChecked="True" Content="{x:Static langs:Lang.Primary}" Margin="5" Style="{StaticResource ToggleButtonPrimary}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="{x:Static langs:Lang.Primary}" Margin="5" Style="{StaticResource ToggleButtonPrimary}"></ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonPrimary"></TextBlock>
</StackPanel>
<StackPanel>
<ToggleButton IsChecked="True" Content="成功" Margin="5" Style="{StaticResource ToggleButtonSuccess}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="成功" Margin="5" Style="{StaticResource ToggleButtonSuccess}"></ToggleButton>
<ToggleButton IsChecked="True" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ToggleButtonSuccess}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ToggleButtonSuccess}"></ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonSuccess"></TextBlock>
</StackPanel>
<StackPanel>
<ToggleButton Content="信息" Margin="5" Style="{StaticResource ToggleButtonInfo}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="信息" Margin="5" Style="{StaticResource ToggleButtonInfo}"></ToggleButton>
<ToggleButton Content="{x:Static langs:Lang.Info}" Margin="5" Style="{StaticResource ToggleButtonInfo}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="{x:Static langs:Lang.Info}" Margin="5" Style="{StaticResource ToggleButtonInfo}"></ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonInfo"></TextBlock>
</StackPanel>
<StackPanel>
<ToggleButton Content="警告" Margin="5" Style="{StaticResource ToggleButtonWarning}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="警告" Margin="5" Style="{StaticResource ToggleButtonWarning}"></ToggleButton>
<ToggleButton Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ToggleButtonWarning}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ToggleButtonWarning}"></ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonWarning"></TextBlock>
</StackPanel>
<StackPanel>
<ToggleButton Content="危险" Margin="5" Style="{StaticResource ToggleButtonDanger}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="危险" Margin="5" Style="{StaticResource ToggleButtonDanger}"></ToggleButton>
<ToggleButton Content="{x:Static langs:Lang.Danger}" Margin="5" Style="{StaticResource ToggleButtonDanger}"></ToggleButton>
<ToggleButton IsEnabled="False" Content="{x:Static langs:Lang.Danger}" Margin="5" Style="{StaticResource ToggleButtonDanger}"></ToggleButton>
<TextBlock Style="{StaticResource TextBlockDefault}" Text="ToggleButtonDanger"></TextBlock>
</StackPanel>
<StackPanel>
@@ -1,33 +1,32 @@
using System;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls;
using HandyControl.Tools;
namespace HandyControlDemo.ViewModel
{
public class GrowlDemoViewModel
{
public RelayCommand InfoCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Info(ResourceHelper.GetString("GrowlInfo")))).Value;
new RelayCommand(() => Growl.Info(Properties.Langs.Lang.GrowlInfo))).Value;
public RelayCommand SuccessCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Success(ResourceHelper.GetString("GrowlSuccess")))).Value;
new RelayCommand(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess))).Value;
public RelayCommand WarningCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Warning(ResourceHelper.GetString("GrowlWarning")))).Value;
new RelayCommand(() => Growl.Warning(Properties.Langs.Lang.GrowlWarning))).Value;
public RelayCommand ErrorCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Error(ResourceHelper.GetString("GrowlError")))).Value;
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError))).Value;
public RelayCommand AskCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Ask("GrowlAsk", (closeAction, b) =>
new RelayCommand(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, (closeAction, b) =>
{
Growl.Info(b.ToString());
closeAction?.Invoke();
}))).Value;
public RelayCommand FatalCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => Growl.Fatal(ResourceHelper.GetString("GrowlFatal")))).Value;
new RelayCommand(() => Growl.Fatal(Properties.Langs.Lang.GrowlFatal))).Value;
public RelayCommand ClearCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(Growl.Clear)).Value;
@@ -1,5 +1,5 @@
using System;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
using HandyControl.Controls;
namespace HandyControlDemo.ViewModel
+17 -1
View File
@@ -2,7 +2,7 @@
using System.Windows;
using System.Windows.Controls;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
using GalaSoft.MvvmLight.Messaging;
using HandyControlDemo.Data;
using HandyControlDemo.UserControl;
@@ -33,12 +33,18 @@ namespace HandyControlDemo.ViewModel
/// </summary>
private object _subContent;
/// <summary>
/// 非用户区域内容
/// </summary>
private object _noUserContent;
#endregion
public MainViewModel()
{
LeftMainContent = ControlLocator.Instance.LeftMainContent;
MainContent = ControlLocator.Instance.MainContent;
NoUserContent = ControlLocator.Instance.NoUserContent;
Messenger.Default.Register<object>(this, MessageToken.LoadGrowlDemoCtl, obj => SubContent = ControlLocator.Instance.GrowlDemoCtl);
Messenger.Default.Register<object>(this, MessageToken.LoadLoadingDemoCtl, obj => SubContent = ControlLocator.Instance.LoadingDemoCtl);
@@ -53,10 +59,20 @@ namespace HandyControlDemo.ViewModel
Messenger.Default.Register<object>(this, MessageToken.LoadAnimationPathDemoCtl, obj => SubContent = ControlLocator.Instance.AnimationPathDemoCtl);
Messenger.Default.Register<object>(this, MessageToken.LoadButtonDemoCtl, obj => SubContent = ControlLocator.Instance.ButtonDemoCtl);
Messenger.Default.Register<object>(this, MessageToken.LoadToggleButtonDemoCtl, obj => SubContent = ControlLocator.Instance.ToggleButtonDemoCtl);
Messenger.Default.Register<object>(this, MessageToken.LoadTabControlDemoCtl, obj => SubContent = ControlLocator.Instance.TabControlDemoCtl);
}
#region 属性
/// <summary>
/// 非用户区域内容
/// </summary>
public object NoUserContent
{
get => _noUserContent;
set => Set(ref _noUserContent, value);
}
/// <summary>
/// 左侧主内容
/// </summary>
+7 -4
View File
@@ -54,6 +54,10 @@
![进度条ProgressBar](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ProgressBar.gif)
### 12、选项卡控件TabControl
![选项卡控件TabControl](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/TabControl.gif)
# 使用方法
第一步:添加HandyControl的引用;
@@ -85,10 +89,9 @@
```
* 为什么我连编译都无法通过:
编译之前,请确保IDE为vs2017且c#最低版本为7.0,HandyControl目前仅支持4.5以上的.net环境,低版本支持估计很快就有了。
编译之前,请确保IDE为vs2017且c#最低版本为7.0,HandyControl目前仅支持4.5以上的.net环境。
# v1.3.0版本计划
1、添加可拖动的tabcontrol;
2、添加时间、日历控件;
3、添加步骤条控件;
1、添加时间、日历控件;
2、添加步骤条控件;
Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB