DropDownButton 类

定义

表示包含 V 形的按钮,用于指示菜单可以打开。

本文档适用于Windows 应用 SDK中的 WinUI 2 for UWP (for WinUI,请参阅Windows 应用 SDK命名空间) 。

/// [Microsoft.UI.Xaml.MUXContractProperty(version=7)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
class DropDownButton : Button
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
/// [Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=7)]
class DropDownButton : Button
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 65536)]
class DropDownButton : Button
[Microsoft.UI.Xaml.MUXContractProperty(version=7)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
public class DropDownButton : Button
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
[Microsoft.UI.Xaml.CustomAttributes.MUXContractProperty(version=7)]
public class DropDownButton : Button
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 65536)]
public class DropDownButton : Button
Public Class DropDownButton
Inherits Button
<DropDownButton />
继承
DropDownButton
属性
Microsoft.UI.Xaml.MUXContractPropertyAttribute MarshalingBehaviorAttribute ThreadingAttribute VersionAttribute Microsoft.UI.Xaml.CustomAttributes.MUXContractPropertyAttribute ContractVersionAttribute

示例

提示

有关详细信息、设计指南和代码示例,请参阅 按钮

WinUI 2 库应用包括大多数 WinUI 2 控件、特性和功能的交互式示例。 通过 Microsoft Store 获取应用,或在 GitHub 上获取源代码。

注解

V 形是一个视觉指示器,指示浮出控件可用于选项菜单。 DropDownButton 的行为与带有浮出控件的标准 Button 相同, (只有外观) 不同。

有关详细信息和示例,请参阅 按钮

控件样式和模板

可以修改默认 的 StyleControlTemplate ,为控件提供唯一的外观。 有关修改控件样式和模板的信息,请参阅 XAML 样式。 文件中包含 generic.xaml 定义控件外观的默认样式、模板和资源。 出于设计目的, generic.xaml 随 WinUI (Microsoft.UI.Xaml) NuGet 包一起安装。 默认情况下,此位置是 \Users\<username>\.nuget\packages\microsoft.ui.xaml\<version>\lib\uap10.0\Microsoft.UI.Xaml\Themes\generic.xaml。 不同版本的 WinUI 的样式和资源可能具有不同的值。

XAML 还包括可用于在不修改控件模板的情况下修改不同视觉状态下控件颜色的资源。 修改这些资源优先于设置 背景前台等属性。 有关详细信息,请参阅 XAML 样式一文的轻量级样式部分。

构造函数

DropDownButton()

初始化 DropDownButton 类的新实例。

本文档适用于Windows 应用 SDK中的 WinUI 2 for UWP (for WinUI,请参阅Windows 应用 SDK命名空间) 。

适用于

另请参阅