syncfusion-wpf-dropdownbuttonadv
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing WPF DropDownButtonAdv
实现WPF DropDownButtonAdv
The is a WPF dropdown button control that displays a popup menu when the arrow is clicked. It supports menu items with icons, data binding, command binding, configurable popup direction, resizing, multiline text, and full theme support.
DropDownButtonAdvAssembly:
Namespace:
XAML Schema:
Syncfusion.Shared.WPFNamespace:
Syncfusion.Windows.Tools.ControlsXAML Schema:
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"DropDownButtonAdv程序集:
命名空间:
XAML架构:
Syncfusion.Shared.WPF命名空间:
Syncfusion.Windows.Tools.ControlsXAML架构:
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"When to Use This Skill
何时使用本技能
- User wants a button that opens a dropdown list of options
- User needs a WPF dropdown button with icons, checkable items, or grouped items
- User asks about ,
DropDownButtonAdv,DropDownMenuGroupDropDownMenuItem - User needs MVVM binding for dropdown menu items or command binding
- User needs to control popup direction, resizing, or multiline label
- User asks how to handle dropdown open/close events or item click events
- 用户需要一个可打开选项下拉列表的按钮
- 用户需要带有图标、可选项目或分组项目的WPF下拉按钮
- 用户询问、
DropDownButtonAdv、DropDownMenuGroup相关问题DropDownMenuItem - 用户需要为下拉菜单项或命令绑定实现MVVM绑定
- 用户需要控制弹出方向、调整大小或多行标签
- 用户询问如何处理下拉菜单的打开/关闭事件或项目点击事件
Quick Start
快速开始
xaml
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
<syncfusion:DropDownButtonAdv Label="Country" SizeMode="Normal" SmallIcon="Images/flag.png">
<syncfusion:DropDownMenuGroup>
<syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="India">
<syncfusion:DropDownMenuItem.Icon>
<Image Source="Images/india.png"/>
</syncfusion:DropDownMenuItem.Icon>
</syncfusion:DropDownMenuItem>
<syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="France"/>
<syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="Germany"/>
</syncfusion:DropDownMenuGroup>
</syncfusion:DropDownButtonAdv>csharp
// C# equivalent
DropDownButtonAdv button = new DropDownButtonAdv();
button.Label = "Country";
button.SizeMode = SizeMode.Normal;
button.SmallIcon = new BitmapImage(new Uri("Images/flag.png", UriKind.RelativeOrAbsolute));
DropDownMenuGroup menu = new DropDownMenuGroup();
menu.Items.Add(new DropDownMenuItem { Header = "India", HorizontalAlignment = HorizontalAlignment.Left });
button.Content = menu;xaml
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
<syncfusion:DropDownButtonAdv Label="Country" SizeMode="Normal" SmallIcon="Images/flag.png">
<syncfusion:DropDownMenuGroup>
<syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="India">
<syncfusion:DropDownMenuItem.Icon>
<Image Source="Images/india.png"/>
</syncfusion:DropDownMenuItem.Icon>
</syncfusion:DropDownMenuItem>
<syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="France"/>
<syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="Germany"/>
</syncfusion:DropDownMenuGroup>
</syncfusion:DropDownButtonAdv>csharp
// C# equivalent
DropDownButtonAdv button = new DropDownButtonAdv();
button.Label = "Country";
button.SizeMode = SizeMode.Normal;
button.SmallIcon = new BitmapImage(new Uri("Images/flag.png", UriKind.RelativeOrAbsolute));
DropDownMenuGroup menu = new DropDownMenuGroup();
menu.Items.Add(new DropDownMenuItem { Header = "India", HorizontalAlignment = HorizontalAlignment.Left });
button.Content = menu;Common Patterns
常见模式
| Goal | Approach |
|---|---|
| Static menu items | Declare |
| Dynamic items from data | Bind |
| MVVM command on item click | Set |
| Popup opens below-left | |
| Large button with label wrapping | |
| Checkable items | |
| Custom UIElement in menu | Use |
| Scrollable long list | Set |
| Resizable popup | |
| 目标 | 实现方式 |
|---|---|
| 静态菜单项 | 在 |
| 来自数据的动态项目 | 绑定 |
| 项目点击的MVVM命令 | 在 |
| 弹出框在左下方打开 | |
| 带标签换行的大按钮 | |
| 可选项目 | 在 |
| 菜单中的自定义UIElement | 使用 |
| 可滚动的长列表 | 在分组上设置 |
| 可调整大小的弹出框 | 在 |
Key Properties
关键属性
| Property | Type | Description |
|---|---|---|
| | Button text label |
| | Small / Normal / Large |
| | Icon for Small and Normal modes |
| | Icon for Large mode |
| | Vector/path icon template (overrides image icons) |
| | Conditionally select icon template |
| | Icon dimensions |
| | Popup position (default: BottomLeft) |
| | Multi-line label (Large mode only) |
| | Data-bound menu items |
| | Show vertical icon bar |
| | Scrollbar in popup |
| | Resize gripper on popup |
| | Custom bottom items |
| | Allow check/uncheck |
| | MVVM command |
| | Command parameter |
| 属性 | 类型 | 描述 |
|---|---|---|
| | 按钮文本标签 |
| | 小/正常/大 |
| | 小和正常模式下的图标 |
| | 大模式下的图标 |
| | 矢量/路径图标模板(覆盖图片图标) |
| | 有条件地选择图标模板 |
| | 图标尺寸 |
| | 弹出框位置(默认:BottomLeft) |
| | 多行标签(仅大模式) |
| | 数据绑定的菜单项 |
| | 显示垂直图标栏 |
| | 弹出框中的滚动条 |
| | 弹出框的调整大小抓手 |
| | 自定义底部项目 |
| | 允许勾选/取消勾选 |
| | MVVM命令 |
| | 命令参数 |
Documentation and Navigation Guide
文档与导航指南
Getting Started
入门指南
📄 Read: references/getting-started.md
- Assembly reference ()
Syncfusion.Shared.WPF - Add via designer, XAML, or C#
- Setting ,
Label(Small/Normal/Large)SizeMode - SmallIcon, LargeIcon, IconWidth/IconHeight
- IconTemplate and IconTemplateSelector
- Basic menu items inline
- Applying themes with SfSkinManager
📄 阅读: references/getting-started.md
- 程序集引用()
Syncfusion.Shared.WPF - 通过设计器、XAML或C#添加控件
- 设置、
Label(小/正常/大)SizeMode - SmallIcon、LargeIcon、IconWidth/IconHeight
- IconTemplate和IconTemplateSelector
- 内联基础菜单项
- 使用SfSkinManager应用主题
Dropdown Menu Items
下拉菜单项
📄 Read: references/dropdown-menu-items.md
- as the container element
DropDownMenuGroup - Declarative with Header and Icon
DropDownMenuItem - (vertical icon strip)
IconBarEnabled - for long item lists
ScrollBarVisibility - gripper for popup resize
IsResizable - /
IsCheckablefor checkable itemsIsChecked - for custom UIElement additions
MoreItems IsMoreItemsIconTrayEnabled
📄 阅读: references/dropdown-menu-items.md
- 作为容器元素
DropDownMenuGroup - 声明式(带Header和Icon)
DropDownMenuItem - (垂直图标条)
IconBarEnabled - 长项目列表的
ScrollBarVisibility - 弹出框调整大小的抓手
IsResizable - 可选项目的/
IsCheckableIsChecked - 添加自定义UIElement的
MoreItems IsMoreItemsIconTrayEnabled
Data Binding
数据绑定
📄 Read: references/data-binding.md
- Model and ViewModel pattern
- Binding
DropDownMenuGroup.ItemsSource - with
ItemTemplateDataTemplate - Binding from ViewModel via
DropDownMenuItem.Commandx:Reference - Full MVVM example with
DelegateCommand<T> - When to use data binding vs declarative items
📄 阅读: references/data-binding.md
- 模型与视图模型模式
- 绑定
DropDownMenuGroup.ItemsSource - 带的
DataTemplateItemTemplate - 通过绑定ViewModel中的
x:ReferenceDropDownMenuItem.Command - 使用的完整MVVM示例
DelegateCommand<T> - 何时使用数据绑定 vs 声明式项目
Command Binding
命令绑定
📄 Read: references/command-binding.md
- and
CommandonCommandParameterDropDownMenuItem - implementation
DelegateCommand<T> - and
CanExecutetoggle patternCanPerformAction - Binding to ViewModel commands in declarative XAML
- Gotchas: scoping commands in DataTemplates
📄 阅读: references/command-binding.md
- 上的
DropDownMenuItem和CommandCommandParameter - 实现
DelegateCommand<T> - 和
CanExecute切换模式CanPerformAction - 在声明式XAML中绑定到ViewModel命令
- 注意事项:DataTemplates中的命令作用域
Dropdown Behavior
下拉行为
📄 Read: references/dropdown-behavior.md
- enum: Left, Right, BottomLeft, BottomRight, TopLeft, TopRight
DropDirection - Default direction is
BottomLeft - for wrapping long labels (Large mode only)
IsMultiLine - for RTL support
FlowDirection
📄 阅读: references/dropdown-behavior.md
- 枚举:Left、Right、BottomLeft、BottomRight、TopLeft、TopRight
DropDirection - 默认方向为
BottomLeft - 长标签换行的(仅大模式)
IsMultiLine - 支持RTL的
FlowDirection
Events & Appearance
事件与外观
📄 Read: references/events-and-appearance.md
- /
DropDownOpeningevents (cancel support)DropDownOpened - /
DropDownClosingeventsDropDownClosed - event
DropDownMenuItem.Click - event
DropDownMenuItem.IsCheckedChanged - Editing control template in Expression Blend or Visual Studio
- SfSkinManager themes + ThemeStudio custom themes
📄 阅读: references/events-and-appearance.md
- /
DropDownOpening事件(支持取消)DropDownOpened - /
DropDownClosing事件DropDownClosed - 事件
DropDownMenuItem.Click - 事件
DropDownMenuItem.IsCheckedChanged - 在Expression Blend或Visual Studio中编辑控件模板
- SfSkinManager主题 + ThemeStudio自定义主题