update docs
This commit is contained in:
1 parent
b0e4b98827
commit
685bb075f2
9 files changed
+363
-14
No files matched your search
@@ -1,5 +1,13 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: SimplePanel 简单面板
|
||||
---
|
||||
|
||||
建设中
|
||||
当不需要Grid的行、列分隔等功能时建议用此轻量级类代替.
|
||||
|
||||
```cs
|
||||
public class SimplePanel : Panel
|
||||
```
|
||||
|
||||
{% note info %}
|
||||
大多数时候,我们要尽量避免使用重量级 `Panel`,`SimplePanel` 在HC中大量使用.
|
||||
{% endnote %}
|
||||
@@ -1,3 +1,54 @@
|
||||
---
|
||||
title: SplitButton
|
||||
title: SplitButton 分割按钮
|
||||
---
|
||||
|
||||
在普通按钮的基础上提供额外的点击项.
|
||||
|
||||
```cs
|
||||
public class SplitButton : ButtonBase
|
||||
```
|
||||
|
||||
# 属性
|
||||
|
||||
|属性|描述|默认值|备注|
|
||||
|-|-|-|-|
|
||||
|HitMode|下拉框触发模式|HitMode.Click||
|
||||
|MaxDropDownHeight|下拉框最大高度|||
|
||||
|IsDropDownOpen|下拉框是否打开|false||
|
||||
|DropDownContent|下拉框内容||||
|
||||
|
||||
# 案例
|
||||
|
||||
```xml
|
||||
<StackPanel Margin="32" VerticalAlignment="Center">
|
||||
<hc:SplitButton Margin="0,0,0,10" Content="{ex:Lang Key={x:Static langs:LangKeys.Default}}" Command="{Binding SelectCmd}" CommandParameter="Command0" HorizontalAlignment="Stretch">
|
||||
<hc:SplitButton.DropDownContent>
|
||||
<StackPanel>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
|
||||
</StackPanel>
|
||||
</hc:SplitButton.DropDownContent>
|
||||
</hc:SplitButton>
|
||||
<hc:SplitButton Style="{StaticResource SplitButtonPrimary}" Margin="0,0,0,10" Content="{ex:Lang Key={x:Static langs:LangKeys.Primary}}" Command="{Binding SelectCmd}" CommandParameter="Command0" HorizontalAlignment="Stretch">
|
||||
<hc:SplitButton.DropDownContent>
|
||||
<StackPanel>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
|
||||
</StackPanel>
|
||||
</hc:SplitButton.DropDownContent>
|
||||
</hc:SplitButton>
|
||||
<hc:SplitButton Style="{StaticResource SplitButtonWarning}" Margin="0,0,0,10" Content="{ex:Lang Key={x:Static langs:LangKeys.Warning}}" HitMode="Hover" HorizontalAlignment="Stretch">
|
||||
<hc:SplitButton.DropDownContent>
|
||||
<StackPanel>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
|
||||
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
|
||||
</StackPanel>
|
||||
</hc:SplitButton.DropDownContent>
|
||||
</hc:SplitButton>
|
||||
</StackPanel>
|
||||
```
|
||||
|
||||

|
||||
@@ -1,3 +1,43 @@
|
||||
---
|
||||
title: Sprite
|
||||
title: Sprite 精灵
|
||||
---
|
||||
|
||||
可将常用功能集成到 `Sprite` 中而无需打开主程序.
|
||||
|
||||
```cs
|
||||
public sealed class Sprite : System.Windows.Window
|
||||
```
|
||||
|
||||
# 方法
|
||||
|
||||
|名称|说明|
|
||||
|-|-|
|
||||
| Show(object) | 将内容作为控件主体,Pin 到桌面上 |
|
||||
|
||||
# 案例
|
||||
|
||||
```xml
|
||||
<hc:SimplePanel x:Class="HandyControlDemo.UserControl.AppSprite"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol">
|
||||
<Border Background="White" CornerRadius="20" Effect="{StaticResource EffectShadow4}">
|
||||
<Path Width="70" Height="70" Data="{StaticResource LogoGeometry}" Fill="#f06632"/>
|
||||
</Border>
|
||||
<Button Command="hc:ControlCommands.CloseWindow" CommandParameter="{Binding RelativeSource={RelativeSource Self}}" Visibility="{Binding IsMouseOver,RelativeSource={RelativeSource AncestorType=hc:SimplePanel},Converter={StaticResource Boolean2VisibilityConverter}}" Width="22" Height="22" Style="{StaticResource ButtonIcon}" Foreground="White" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-8,-8,0"/>
|
||||
</hc:SimplePanel>
|
||||
```
|
||||
|
||||
```cs
|
||||
public partial class AppSprite
|
||||
{
|
||||
public AppSprite()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```cs
|
||||
Sprite.Show(new AppSprite());
|
||||
```
|
||||
@@ -1,5 +1,93 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: StepBar 步骤条
|
||||
---
|
||||
|
||||
建设中
|
||||
引导用户按照流程完成任务的分步导航条.
|
||||
|
||||
```cs
|
||||
[StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(StepBarItem))]
|
||||
[DefaultEvent("StepChanged")]
|
||||
[TemplatePart(Name = ElementProgressBarBack, Type = typeof(ProgressBar))]
|
||||
public class StepBar : ItemsControl
|
||||
```
|
||||
|
||||
# 属性
|
||||
|
||||
|属性|描述|默认值|备注|
|
||||
|-|-|-|-|
|
||||
|StepIndex|当前步骤序号|0||
|
||||
|Dock|步骤条顶靠方式|Dock.Top|||
|
||||
|
||||
# 方法
|
||||
|
||||
|名称|说明|
|
||||
|-|-|
|
||||
| Next( ) | 跳转到下一步 |
|
||||
| Prev( ) | 跳转到上一步 |
|
||||
|
||||
# 事件
|
||||
|
||||
|名称|说明|
|
||||
|-|-|
|
||||
| StepChanged | 步骤改变时触发 |
|
||||
|
||||
# 案例
|
||||
|
||||
```xml
|
||||
<Grid Margin="32">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<hc:StepBar Grid.ColumnSpan="2" StepIndex="{Binding StepIndex}">
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Register}}"/>
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.BasicInfo}}"/>
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.UploadFile}}"/>
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Complete}}"/>
|
||||
</hc:StepBar>
|
||||
<StackPanel Margin="0,32" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Center">
|
||||
<Button Command="{Binding PrevCmd}" CommandParameter="{Binding ElementName=PanelMain}" Width="180" Content="{ex:Lang Key={x:Static langs:LangKeys.Prev}}" Style="{StaticResource ButtonPrimary}"/>
|
||||
<Button Command="{Binding NextCmd}" CommandParameter="{Binding ElementName=PanelMain}" Width="180" Margin="0,16,0,0" Content="{ex:Lang Key={x:Static langs:LangKeys.Next}}" Style="{StaticResource ButtonPrimary}"/>
|
||||
</StackPanel>
|
||||
<hc:StepBar Margin="0,0,0,32" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Dock="Bottom">
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Register}}"/>
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.BasicInfo}}"/>
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.UploadFile}}"/>
|
||||
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Complete}}"/>
|
||||
</hc:StepBar>
|
||||
<hc:StepBar Grid.Column="0" Grid.Row="3" ItemsSource="{Binding DataList}" Dock="Left">
|
||||
<hc:StepBar.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Left">
|
||||
<Run Text="{ex:Lang Key={Binding Header}}"/>
|
||||
<Run Text="{Binding Index,RelativeSource={RelativeSource AncestorType=hc:StepBarItem}}"/>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="0,4,0,0" Text="{ex:Lang Key={Binding Content}}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</hc:StepBar.ItemTemplate>
|
||||
</hc:StepBar>
|
||||
<hc:StepBar Grid.Column="1" Grid.Row="3" ItemsSource="{Binding DataList}" Dock="Right">
|
||||
<hc:StepBar.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Left">
|
||||
<Run Text="{ex:Lang Key={Binding Header}}"/>
|
||||
<Run Text="{Binding Index,RelativeSource={RelativeSource AncestorType=hc:StepBarItem}}"/>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="0,4,0,0" Text="{ex:Lang Key={Binding Content}}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</hc:StepBar.ItemTemplate>
|
||||
</hc:StepBar>
|
||||
</Grid>
|
||||
```
|
||||
|
||||

|
||||
@@ -1,5 +1,64 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: TabControl 选项卡控件
|
||||
---
|
||||
|
||||
建设中
|
||||
HC 对wpf原生 `TabControl` 的扩展.
|
||||
|
||||
```cs
|
||||
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
|
||||
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
|
||||
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
||||
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(ButtonBase))]
|
||||
[TemplatePart(Name = ScrollButtonRight, Type = typeof(ButtonBase))]
|
||||
[TemplatePart(Name = HeaderBorder, Type = typeof(Border))]
|
||||
public class TabControl : System.Windows.Controls.TabControl
|
||||
```
|
||||
|
||||
# 属性
|
||||
|
||||
|属性|描述|默认值|备注|
|
||||
|-|-|-|-|
|
||||
|IsAnimationEnabled|是否启用动画效果|false||
|
||||
|IsDraggable|选项卡是否支持拖动|false||
|
||||
|ShowCloseButton|选项卡上是否显示关闭按钮|false||
|
||||
|ShowContextMenu|选项卡是否支持上下文菜单|true||
|
||||
|IsTabFillEnabled|选项卡是否自动平分空间|false||
|
||||
|TabItemWidth|选项卡宽度|200||
|
||||
|TabItemHeight|选项卡高度|30||
|
||||
|IsScrollable|选项卡溢出后,是否支持鼠标滚轮滚动|false||
|
||||
|ShowOverflowButton|选项卡溢出后,是否显示下拉按钮|true||
|
||||
|ShowScrollButton|是否显示滚动按钮|false|||
|
||||
|
||||
# 案例
|
||||
|
||||
```xml
|
||||
<hc:TabControl IsAnimationEnabled="True" ShowCloseButton="True" IsDraggable="True" IsTabFillEnabled="True" Width="800" Height="300">
|
||||
<hc:TabItem Header="TabItem1">
|
||||
<hc:SimplePanel Background="{DynamicResource RegionBrush}"/>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem IsSelected="True" Header="TabItem2">
|
||||
<hc:SimplePanel Background="#FFE8563F"/>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Header="TabItem3">
|
||||
<hc:SimplePanel Background="#FF3F4EE8"/>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Header="TabItem4">
|
||||
<hc:SimplePanel Background="#FFE83F6D"/>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Header="TabItem5">
|
||||
<hc:SimplePanel Background="#FFB23FE8"/>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Header="TabItem6">
|
||||
<hc:SimplePanel Background="#FF3FE8E8"/>
|
||||
</hc:TabItem>
|
||||
<hc:TabItem Header="TabItem7">
|
||||
<hc:SimplePanel Background="#FFE8E03F"/>
|
||||
</hc:TabItem>
|
||||
</hc:TabControl>
|
||||
```
|
||||
|
||||

|
||||
|
||||
## TabItem
|
||||
|
||||
你可以使用 `IconElement` 类对选项卡设置图标.
|
||||
@@ -1,5 +1,65 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: Tag 标签
|
||||
---
|
||||
|
||||
建设中
|
||||
用以指示用户选中的项,相对于文字,`Tag` 有额外的交互.
|
||||
|
||||
```cs
|
||||
public class Tag : ContentControl
|
||||
```
|
||||
|
||||
# 属性
|
||||
|
||||
|属性|描述|默认值|备注|
|
||||
|-|-|-|-|
|
||||
|ShowCloseButton|是否显示删除(关闭)按钮|true||
|
||||
|Selectable|是否支持选中|false||
|
||||
|IsSelected|是否选中|false|||
|
||||
|
||||
# 事件
|
||||
|
||||
|名称|说明|
|
||||
|-|-|
|
||||
| Selected | 标签选中时触发 |
|
||||
| Closing | 标签关闭时触发 |
|
||||
| Closed | 标签关闭后触发 |
|
||||
|
||||
# TagPanel
|
||||
|
||||
标签专用容器.
|
||||
|
||||
{% note warning %}
|
||||
即将在未来版本中移除,我们会提供功能更丰富的 `TagContainer` 来代替它.
|
||||
{% endnote %}
|
||||
|
||||
## 属性
|
||||
|
||||
|属性|描述|默认值|备注|
|
||||
|-|-|-|-|
|
||||
|ShowAddButton|是否显示新增标签按钮|false||
|
||||
|TagMargin|标签边距|Thickness(5)|||
|
||||
|
||||
## 事件
|
||||
|
||||
|名称|说明|
|
||||
|-|-|
|
||||
| AddTagButtonClick | 新增标签时触发 |
|
||||
|
||||
# 案例
|
||||
|
||||
```xml
|
||||
<hc:TagPanel AddTagButtonClick="TagPanel_OnAddTagButtonClick" Margin="32" Orientation="Horizontal" MaxWidth="400" VerticalAlignment="Center" ShowAddButton="True">
|
||||
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||
<hc:Tag Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
|
||||
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
|
||||
<hc:Tag Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
||||
<hc:Tag IsSelected="True" Selectable="True" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
|
||||
<hc:Tag Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
|
||||
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||
<hc:Tag IsSelected="True" Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
|
||||
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
|
||||
<hc:Tag Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
||||
</hc:TagPanel>
|
||||
```
|
||||
|
||||

|
||||
@@ -1,5 +1,49 @@
|
||||
---
|
||||
title: 建设中
|
||||
title: TimeBar 时间条
|
||||
---
|
||||
|
||||
建设中
|
||||
一种包含热区和时间刻度的进度条.
|
||||
|
||||
```cs
|
||||
[TemplatePart(Name = ElementBorderTop, Type = typeof(Border))]
|
||||
[TemplatePart(Name = ElementTextBlockMove, Type = typeof(TextBlock))]
|
||||
[TemplatePart(Name = ElementTextBlockSelected, Type = typeof(TextBlock))]
|
||||
[TemplatePart(Name = ElementCanvasSpe, Type = typeof(Canvas))]
|
||||
[TemplatePart(Name = ElementHotspots, Type = typeof(Panel))]
|
||||
public class TimeBar : Control
|
||||
```
|
||||
|
||||
# 属性
|
||||
|
||||
|属性|描述|默认值|备注|
|
||||
|-|-|-|-|
|
||||
|Hotspots|热区集合|||
|
||||
|HotspotsBrush|热区颜色|||
|
||||
|ShowSpeStr|是否显示刻度|false||
|
||||
|TimeFormat|时间格式|yyyy-MM-dd HH:mm:ss||
|
||||
|SelectedTime|当前选中时间||||
|
||||
|
||||
# 事件
|
||||
|
||||
|名称|说明|
|
||||
|-|-|
|
||||
| TimeChanged | 选中时间改变时触发 |
|
||||
|
||||
# 案例
|
||||
|
||||
```xml
|
||||
<hc:TimeBar BorderThickness="0" Width="600"/>
|
||||
```
|
||||
|
||||

|
||||
|
||||
## 设置热区
|
||||
|
||||
```cs
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var hour = 6 * i;
|
||||
TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(hour), DateTime.Today.AddHours(hour + 1)));
|
||||
TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(-hour), DateTime.Today.AddHours(-hour + 1)));
|
||||
}
|
||||
```
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: TimePicker
|
||||
title: TimePicker 时间选择器
|
||||
---
|
||||
|
||||
TimePicker 控件允许用户通过在文本框中键入时间或使用下拉的日历控件来选择时间。
|
||||
|
||||
Vendored
-1
@@ -16,7 +16,6 @@
|
||||
|
||||
<html class="{{ html_class | lower }}" lang="{{ config.language }}">
|
||||
<head>
|
||||
<script data-ad-client="ca-pub-8129276259146154" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
{{ partial('_partials/head/head.swig', {}, {cache: theme.cache.enable}) }}
|
||||
{% include '_partials/head/head-unique.swig' %}
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
|
||||
Reference in new issue
Block a user