Skip to content

Commit 685bb07

Browse files
committed
update docs
1 parent b0e4b98 commit 685bb07

9 files changed

Lines changed: 363 additions & 14 deletions

File tree

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
---
2-
title: 建设中
2+
title: SimplePanel 简单面板
33
---
44

5-
建设中
5+
当不需要Grid的行、列分隔等功能时建议用此轻量级类代替.
6+
7+
```cs
8+
public class SimplePanel : Panel
9+
```
10+
11+
{% note info %}
12+
大多数时候,我们要尽量避免使用重量级 `Panel`,`SimplePanel` 在HC中大量使用.
13+
{% endnote %}
Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
11
---
2-
title: SplitButton
2+
title: SplitButton 分割按钮
33
---
4+
5+
在普通按钮的基础上提供额外的点击项.
6+
7+
```cs
8+
public class SplitButton : ButtonBase
9+
```
10+
11+
# 属性
12+
13+
|属性|描述|默认值|备注|
14+
|-|-|-|-|
15+
|HitMode|下拉框触发模式|HitMode.Click||
16+
|MaxDropDownHeight|下拉框最大高度|||
17+
|IsDropDownOpen|下拉框是否打开|false||
18+
|DropDownContent|下拉框内容||||
19+
20+
# 案例
21+
22+
```xml
23+
<StackPanel Margin="32" VerticalAlignment="Center">
24+
<hc:SplitButton Margin="0,0,0,10" Content="{ex:Lang Key={x:Static langs:LangKeys.Default}}" Command="{Binding SelectCmd}" CommandParameter="Command0" HorizontalAlignment="Stretch">
25+
<hc:SplitButton.DropDownContent>
26+
<StackPanel>
27+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
28+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
29+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
30+
</StackPanel>
31+
</hc:SplitButton.DropDownContent>
32+
</hc:SplitButton>
33+
<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">
34+
<hc:SplitButton.DropDownContent>
35+
<StackPanel>
36+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
37+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
38+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
39+
</StackPanel>
40+
</hc:SplitButton.DropDownContent>
41+
</hc:SplitButton>
42+
<hc:SplitButton Style="{StaticResource SplitButtonWarning}" Margin="0,0,0,10" Content="{ex:Lang Key={x:Static langs:LangKeys.Warning}}" HitMode="Hover" HorizontalAlignment="Stretch">
43+
<hc:SplitButton.DropDownContent>
44+
<StackPanel>
45+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command1"/>
46+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command2"/>
47+
<MenuItem Header="{ex:Lang Key={x:Static langs:LangKeys.Title}}" Command="{Binding SelectCmd}" CommandParameter="Command3"/>
48+
</StackPanel>
49+
</hc:SplitButton.DropDownContent>
50+
</hc:SplitButton>
51+
</StackPanel>
52+
```
53+
54+
![SplitButton](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/SplitButton.png)
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
11
---
2-
title: Sprite
2+
title: Sprite 精灵
33
---
4+
5+
可将常用功能集成到 `Sprite` 中而无需打开主程序.
6+
7+
```cs
8+
public sealed class Sprite : System.Windows.Window
9+
```
10+
11+
# 方法
12+
13+
|名称|说明|
14+
|-|-|
15+
| Show(object) | 将内容作为控件主体,Pin 到桌面上 |
16+
17+
# 案例
18+
19+
```xml
20+
<hc:SimplePanel x:Class="HandyControlDemo.UserControl.AppSprite"
21+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
23+
xmlns:hc="https://handyorg.github.io/handycontrol">
24+
<Border Background="White" CornerRadius="20" Effect="{StaticResource EffectShadow4}">
25+
<Path Width="70" Height="70" Data="{StaticResource LogoGeometry}" Fill="#f06632"/>
26+
</Border>
27+
<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"/>
28+
</hc:SimplePanel>
29+
```
30+
31+
```cs
32+
public partial class AppSprite
33+
{
34+
public AppSprite()
35+
{
36+
InitializeComponent();
37+
}
38+
}
39+
```
40+
41+
```cs
42+
Sprite.Show(new AppSprite());
43+
```
Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,93 @@
11
---
2-
title: 建设中
2+
title: StepBar 步骤条
33
---
44

5-
建设中
5+
引导用户按照流程完成任务的分步导航条.
6+
7+
```cs
8+
[StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(StepBarItem))]
9+
[DefaultEvent("StepChanged")]
10+
[TemplatePart(Name = ElementProgressBarBack, Type = typeof(ProgressBar))]
11+
public class StepBar : ItemsControl
12+
```
13+
14+
# 属性
15+
16+
|属性|描述|默认值|备注|
17+
|-|-|-|-|
18+
|StepIndex|当前步骤序号|0||
19+
|Dock|步骤条顶靠方式|Dock.Top|||
20+
21+
# 方法
22+
23+
|名称|说明|
24+
|-|-|
25+
| Next( ) | 跳转到下一步 |
26+
| Prev( ) | 跳转到上一步 |
27+
28+
# 事件
29+
30+
|名称|说明|
31+
|-|-|
32+
| StepChanged | 步骤改变时触发 |
33+
34+
# 案例
35+
36+
```xml
37+
<Grid Margin="32">
38+
<Grid.RowDefinitions>
39+
<RowDefinition Height="Auto"/>
40+
<RowDefinition Height="Auto"/>
41+
<RowDefinition Height="Auto"/>
42+
<RowDefinition Height="Auto"/>
43+
</Grid.RowDefinitions>
44+
<Grid.ColumnDefinitions>
45+
<ColumnDefinition/>
46+
<ColumnDefinition/>
47+
</Grid.ColumnDefinitions>
48+
<hc:StepBar Grid.ColumnSpan="2" StepIndex="{Binding StepIndex}">
49+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Register}}"/>
50+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.BasicInfo}}"/>
51+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.UploadFile}}"/>
52+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Complete}}"/>
53+
</hc:StepBar>
54+
<StackPanel Margin="0,32" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Center">
55+
<Button Command="{Binding PrevCmd}" CommandParameter="{Binding ElementName=PanelMain}" Width="180" Content="{ex:Lang Key={x:Static langs:LangKeys.Prev}}" Style="{StaticResource ButtonPrimary}"/>
56+
<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}"/>
57+
</StackPanel>
58+
<hc:StepBar Margin="0,0,0,32" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Dock="Bottom">
59+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Register}}"/>
60+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.BasicInfo}}"/>
61+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.UploadFile}}"/>
62+
<hc:StepBarItem Content="{ex:Lang Key={x:Static langs:LangKeys.Complete}}"/>
63+
</hc:StepBar>
64+
<hc:StepBar Grid.Column="0" Grid.Row="3" ItemsSource="{Binding DataList}" Dock="Left">
65+
<hc:StepBar.ItemTemplate>
66+
<DataTemplate>
67+
<StackPanel>
68+
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Left">
69+
<Run Text="{ex:Lang Key={Binding Header}}"/>
70+
<Run Text="{Binding Index,RelativeSource={RelativeSource AncestorType=hc:StepBarItem}}"/>
71+
</TextBlock>
72+
<TextBlock Margin="0,4,0,0" Text="{ex:Lang Key={Binding Content}}"/>
73+
</StackPanel>
74+
</DataTemplate>
75+
</hc:StepBar.ItemTemplate>
76+
</hc:StepBar>
77+
<hc:StepBar Grid.Column="1" Grid.Row="3" ItemsSource="{Binding DataList}" Dock="Right">
78+
<hc:StepBar.ItemTemplate>
79+
<DataTemplate>
80+
<StackPanel>
81+
<TextBlock FontSize="16" FontWeight="Bold" HorizontalAlignment="Left">
82+
<Run Text="{ex:Lang Key={Binding Header}}"/>
83+
<Run Text="{Binding Index,RelativeSource={RelativeSource AncestorType=hc:StepBarItem}}"/>
84+
</TextBlock>
85+
<TextBlock Margin="0,4,0,0" Text="{ex:Lang Key={Binding Content}}"/>
86+
</StackPanel>
87+
</DataTemplate>
88+
</hc:StepBar.ItemTemplate>
89+
</hc:StepBar>
90+
</Grid>
91+
```
92+
93+
![StepBar](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/StepBar.png)
Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,64 @@
11
---
2-
title: 建设中
2+
title: TabControl 选项卡控件
33
---
44

5-
建设中
5+
HC 对wpf原生 `TabControl` 的扩展.
6+
7+
```cs
8+
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
9+
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
10+
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
11+
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(ButtonBase))]
12+
[TemplatePart(Name = ScrollButtonRight, Type = typeof(ButtonBase))]
13+
[TemplatePart(Name = HeaderBorder, Type = typeof(Border))]
14+
public class TabControl : System.Windows.Controls.TabControl
15+
```
16+
17+
# 属性
18+
19+
|属性|描述|默认值|备注|
20+
|-|-|-|-|
21+
|IsAnimationEnabled|是否启用动画效果|false||
22+
|IsDraggable|选项卡是否支持拖动|false||
23+
|ShowCloseButton|选项卡上是否显示关闭按钮|false||
24+
|ShowContextMenu|选项卡是否支持上下文菜单|true||
25+
|IsTabFillEnabled|选项卡是否自动平分空间|false||
26+
|TabItemWidth|选项卡宽度|200||
27+
|TabItemHeight|选项卡高度|30||
28+
|IsScrollable|选项卡溢出后,是否支持鼠标滚轮滚动|false||
29+
|ShowOverflowButton|选项卡溢出后,是否显示下拉按钮|true||
30+
|ShowScrollButton|是否显示滚动按钮|false|||
31+
32+
# 案例
33+
34+
```xml
35+
<hc:TabControl IsAnimationEnabled="True" ShowCloseButton="True" IsDraggable="True" IsTabFillEnabled="True" Width="800" Height="300">
36+
<hc:TabItem Header="TabItem1">
37+
<hc:SimplePanel Background="{DynamicResource RegionBrush}"/>
38+
</hc:TabItem>
39+
<hc:TabItem IsSelected="True" Header="TabItem2">
40+
<hc:SimplePanel Background="#FFE8563F"/>
41+
</hc:TabItem>
42+
<hc:TabItem Header="TabItem3">
43+
<hc:SimplePanel Background="#FF3F4EE8"/>
44+
</hc:TabItem>
45+
<hc:TabItem Header="TabItem4">
46+
<hc:SimplePanel Background="#FFE83F6D"/>
47+
</hc:TabItem>
48+
<hc:TabItem Header="TabItem5">
49+
<hc:SimplePanel Background="#FFB23FE8"/>
50+
</hc:TabItem>
51+
<hc:TabItem Header="TabItem6">
52+
<hc:SimplePanel Background="#FF3FE8E8"/>
53+
</hc:TabItem>
54+
<hc:TabItem Header="TabItem7">
55+
<hc:SimplePanel Background="#FFE8E03F"/>
56+
</hc:TabItem>
57+
</hc:TabControl>
58+
```
59+
60+
![TabControl](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/TabControl.gif)
61+
62+
## TabItem
63+
64+
你可以使用 `IconElement` 类对选项卡设置图标.
Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
---
2-
title: 建设中
2+
title: Tag 标签
33
---
44

5-
建设中
5+
用以指示用户选中的项,相对于文字,`Tag` 有额外的交互.
6+
7+
```cs
8+
public class Tag : ContentControl
9+
```
10+
11+
# 属性
12+
13+
|属性|描述|默认值|备注|
14+
|-|-|-|-|
15+
|ShowCloseButton|是否显示删除(关闭)按钮|true||
16+
|Selectable|是否支持选中|false||
17+
|IsSelected|是否选中|false|||
18+
19+
# 事件
20+
21+
|名称|说明|
22+
|-|-|
23+
| Selected | 标签选中时触发 |
24+
| Closing | 标签关闭时触发 |
25+
| Closed | 标签关闭后触发 |
26+
27+
# TagPanel
28+
29+
标签专用容器.
30+
31+
{% note warning %}
32+
即将在未来版本中移除,我们会提供功能更丰富的 `TagContainer` 来代替它.
33+
{% endnote %}
34+
35+
## 属性
36+
37+
|属性|描述|默认值|备注|
38+
|-|-|-|-|
39+
|ShowAddButton|是否显示新增标签按钮|false||
40+
|TagMargin|标签边距|Thickness(5)|||
41+
42+
## 事件
43+
44+
|名称|说明|
45+
|-|-|
46+
| AddTagButtonClick | 新增标签时触发 |
47+
48+
# 案例
49+
50+
```xml
51+
<hc:TagPanel AddTagButtonClick="TagPanel_OnAddTagButtonClick" Margin="32" Orientation="Horizontal" MaxWidth="400" VerticalAlignment="Center" ShowAddButton="True">
52+
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
53+
<hc:Tag Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
54+
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
55+
<hc:Tag Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
56+
<hc:Tag IsSelected="True" Selectable="True" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
57+
<hc:Tag Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
58+
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
59+
<hc:Tag IsSelected="True" Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
60+
<hc:Tag ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
61+
<hc:Tag Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
62+
</hc:TagPanel>
63+
```
64+
65+
![Tag](https://raw.githubusercontent.com/HandyOrg/HandyOrgResource/master/HandyControl/Resources/Tag.png)

0 commit comments

Comments
 (0)