-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from 2b-creator/main
Docs
- Loading branch information
Showing
13 changed files
with
507 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# CheckBox | ||
|
||
类型:System.Windows.Controls.Primitives.CheckBox | ||
|
||
继承:System.Windows.Controls.Primitives.ButtonBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# DropDownButton | ||
|
||
类型: INKORE.UI.WPF.Modern.Controls.DropDownButton | ||
|
||
继承: System.Windows.Controls.Button | ||
|
||
## 属性 | ||
|
||
### CornerRadius | ||
|
||
- **类型**: `DependencyProperty` | ||
- **默认值**: `0` | ||
- **描述**: 定义按钮的边角半径,以 `CornerRadius` 对象表示。该值指定按钮四个角的圆角半径大小。较大的值将产生更圆的角。 | ||
|
||
--- | ||
|
||
### ShowChevronArrow | ||
|
||
- **类型**: `DependencyProperty` | ||
- **默认值**: `true` | ||
- **描述**: 指示是否显示按钮上的下拉箭头。如果设置为 `true`,则会显示箭头,否则不显示。 | ||
|
||
--- | ||
|
||
### UseSystemFocusVisuals | ||
|
||
- **类型**: `DependencyProperty` | ||
- **默认值**: `false` | ||
- **描述**: 指示是否使用系统提供的焦点可视化效果。如果设置为 `true`,则按钮获得焦点时将使用系统默认的焦点可视化效果。 | ||
|
||
--- | ||
|
||
### FocusVisualMargin | ||
|
||
- **类型**: `DependencyProperty` | ||
- **默认值**: `0` | ||
- **描述**: 定义焦点可视化效果的边距。该值指定了焦点可视化效果与按钮边缘之间的距离。 | ||
|
||
--- | ||
|
||
### Flyout | ||
|
||
- **类型**: `DependencyProperty` | ||
- **默认值**: `null` | ||
- **描述**: 指定与按钮关联的飞出菜单(`FlyoutBase`)。当按钮被点击或悬停时,此飞出菜单将显示。 | ||
|
||
--- | ||
|
||
### FlyoutOpeningMode | ||
|
||
- **类型**: `DependencyProperty` | ||
- **默认值**: `OnClick` | ||
- **描述**: 定义飞出菜单的打开模式。 | ||
|
||
--- | ||
|
||
这些属性用于 `DropDownButton` 类,可以通过设置它们来配置按钮的外观和行为。 | ||
|
||
## 方法 | ||
- **OpenFlyout()**: 打开与按钮关联的飞出菜单。 | ||
- **CloseFlyout()**: 关闭与按钮关联的飞出菜单。 | ||
|
||
## 事件处理 | ||
- **OnFlyoutOpened(object sender, object e)**: 当飞出菜单打开时调用的事件处理方法。 | ||
|
||
- **OnFlyoutClosed(object sender, object e)**: 当飞出菜单关闭时调用的事件处理方法。 | ||
|
||
## 内部字段 | ||
- **IsFlyoutOpen**: `bool`, 标识飞出菜单是否已打开的内部字段 | ||
|
||
## Automation | ||
- **OnCreateAutomationPeer()**: | ||
- **DropDownButtonAutomationPeer**: | ||
|
||
## 样例 | ||
### 创建一个 DropDownButton | ||
```xaml | ||
<ui:DropDownButton Content="Email"> | ||
<ui:DropDownButton.Flyout> | ||
<ui:MenuFlyout Placement="Bottom"> | ||
<MenuItem Header="Send"/> | ||
<MenuItem Header="Reply"/> | ||
<MenuItem Header="Reply All"/> | ||
</ui:MenuFlyout> | ||
</ui:DropDownButton.Flyout> | ||
</ui:DropDownButton> | ||
``` | ||
|
||
下面是等效的 C# 代码 | ||
|
||
```csharp | ||
MenuFlyout menuFlyout = new MenuFlyout { Placement = FlyoutPlacementMode.Bottom }; | ||
|
||
MenuItem newMenuItem = new MenuItem(); | ||
string[] items = ["Send", "Reply", "Reply All"] | ||
for (i=0; i < item.Length; i++) | ||
{ | ||
newMenuItem.Header = items[i]; | ||
menuFlyout.Items.Add(newMenuItem); | ||
} | ||
|
||
DropDownButton dropDownButton = new DropDownButton { Content = "Email", Flyout = menuFlyout }; | ||
``` | ||
|
||
效果: | ||
|
||
![t.gif](./../../images/DropDownButton/1.gif) | ||
|
||
### 带有图标的 DropDownButton | ||
|
||
```xaml | ||
<ui:DropDownButton AutomationProperties.Name="Email"> | ||
<ui:DropDownButton.Content> | ||
<ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="{x:Static ui:SegoeIcons.Mail}"/> | ||
</ui:DropDownButton.Content> | ||
<ui:DropDownButton.Flyout> | ||
<ui:MenuFlyout Placement="Bottom"> | ||
<MenuItem Header="Send"> | ||
<MenuItem.Icon> | ||
<ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="{x:Static ui:SegoeIcons.Send}"/> | ||
</MenuItem.Icon> | ||
</MenuItem> | ||
<MenuItem Header="Reply"> | ||
<MenuItem.Icon> | ||
<ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="{x:Static ui:SegoeIcons.MailReply}"/> | ||
</MenuItem.Icon> | ||
</MenuItem> | ||
<MenuItem Header="Reply All"> | ||
<MenuItem.Icon> | ||
<ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="{x:Static ui:SegoeIcons.MailReplyAll}"/> | ||
</MenuItem.Icon> | ||
</MenuItem> | ||
</ui:MenuFlyout> | ||
</ui:DropDownButton.Flyout> | ||
</ui:DropDownButton> | ||
``` | ||
|
||
下面是等效的 C# 代码: | ||
|
||
```csharp | ||
DropDownButton dropDownButton = new DropDownButton(); | ||
dropDownButton.AutomationProperties.Name = "Email"; | ||
|
||
FontIcon contentFontIcon = new FontIcon(); | ||
contentFontIcon.FontFamily = new FontFamily("Segoe MDL2 Assets"); | ||
contentFontIcon.Glyph = SegoeIcons.Mail; | ||
dropDownButton.Content = contentFontIcon; | ||
|
||
MenuFlyout menuFlyout = new MenuFlyout(); | ||
menuFlyout.Placement = FlyoutPlacementMode.Bottom; | ||
|
||
(string Header, SegoeIcons Glyph)[] menuItems = { | ||
("Send", SegoeIcons.Send), | ||
("Reply", SegoeIcons.MailReply), | ||
("Reply All", SegoeIcons.MailReplyAll) | ||
}; | ||
|
||
foreach (var item in menuItems) | ||
{ | ||
MenuItem menuItem = new MenuItem(); | ||
menuItem.Header = item.Header; | ||
|
||
FontIcon icon = new FontIcon(); | ||
icon.FontFamily = new FontFamily("Segoe MDL2 Assets"); | ||
icon.Glyph = item.Glyph; | ||
menuItem.Icon = icon; | ||
|
||
menuFlyout.Items.Add(menuItem); | ||
} | ||
|
||
dropDownButton.Flyout = menuFlyout; | ||
``` | ||
|
||
效果: | ||
|
||
![](./../../images/DropDownButton/2.gif) | ||
|
||
## 参考 | ||
|
||
[System.Windows.Controls.Button](Button.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# HyperlinkButton | ||
|
||
类型: INKORE.UI.WPF.Modern.Controls.HyperlinkButton | ||
|
||
继承: System.Windows.Controls.Primitives.ButtonBase | ||
|
||
`HyperlinkButton` 类是一个按钮控件,用于在 WPF 应用程序中创建类似超链接的按钮, 继承自 `ButtonBase` 类。 | ||
|
||
## 构造函数 | ||
|
||
- **HyperlinkButton()**: 创建一个新的 `HyperlinkButton` 实例。 | ||
|
||
## 属性 | ||
|
||
### NavigateUri | ||
|
||
- 类型:`Uri` | ||
- 默认值:`null` | ||
|
||
- 描述:超链接的目标 URI。 | ||
|
||
--- | ||
|
||
### **RaiseHyperlinkClicks** | ||
|
||
- 类型:`bool` | ||
- 默认值:`true` | ||
|
||
- 描述:是否在点击按钮时触发超链接点击事件。 | ||
|
||
--- | ||
|
||
### TargetName | ||
|
||
- 类型:`string` | ||
- 默认值:`null` | ||
|
||
- 描述:超链接的目标名称。 | ||
|
||
--- | ||
|
||
### UseSystemFocusVisuals | ||
|
||
- 类型:`bool` | ||
- 默认值:`false` | ||
|
||
- 描述:是否使用系统提供的焦点可视化效果。 | ||
|
||
--- | ||
|
||
### FocusVisualMargin | ||
|
||
- 类型:`Thickness` | ||
- 默认值:`{0,0,0,0}` | ||
- 描述:焦点可视化效果的边距。 | ||
|
||
--- | ||
|
||
## 方法 | ||
|
||
1. **OnClick()**: 当按钮被点击时调用的方法,用于触发超链接点击事件。 | ||
2. **AutomationButtonBaseClick()**: 执行按钮点击的内部方法,用于触发按钮点击事件。 | ||
3. **OnRequestNavigate(object sender, RequestNavigateEventArgs e)**: 处理超链接点击事件的方法,根据超链接的 URI 进行导航操作。 | ||
|
||
## 事件处理方法 | ||
|
||
- **OnNavigateUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)**: 当 NavigateUri 属性值发生变化时调用的方法,用于更新超链接的目标 URI。 | ||
- **OnTargetNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)**: 当 TargetName 属性值发生变化时调用的方法,用于更新超链接的目标名称。 | ||
|
||
## Automation | ||
|
||
- **OnCreateAutomationPeer()**: 创建自定义控件的自动化对等体。 | ||
- **HyperlinkButtonAutomationPeer**: `HyperlinkButton` 控件的自动化对等体类,用于支持 UI 自动化。 | ||
|
||
## 内部字段 | ||
|
||
- **m_hyperlink**: 内部保存的 `Hyperlink` 对象,用于实现超链接功能。 | ||
|
||
## 样例 | ||
|
||
### 创建一个 HyperlinkButton | ||
|
||
```xaml | ||
<ui:HyperlinkButton Content="Microsoft home page" NavigateUri="http://www.microsoft.com" /> | ||
``` | ||
|
||
等效的 C# 代码如下 | ||
|
||
```csharp | ||
System.Uri uri = new Uri("http://www.microsoft.com"); | ||
HyperlinkButton hyperlinkButton = new HyperlinkButton() { Content = "Microsoft home page", NavigateUri = uri }; | ||
``` | ||
|
||
效果: | ||
|
||
![HyperlinkButton](./../../images/HyperlinkButton/1.gif) | ||
|
||
## 参考 | ||
|
||
System.Windows.Controls.Primitives.ButtonBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# RepeatButton | ||
|
||
类型:System.Windows.Controls.Primitives.RepeatButton | ||
|
||
继承:System.Windows.Controls.Primitives.ButtonBase | ||
|
Oops, something went wrong.