DevExpress WPF 15.2代码示例:如何实现工具条合并
作者: 来源: 浏览:Loading...次 发布时间:2015-12-18 评论:0条
本示例演示在不支持自动合并的控件中如何实现工具条的合并操作。
代码:C# | 版本:15.2.4
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" x:Class="WpfApplication20.MainWindow" Title="MainWindow" Height="275" Width="525"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <dxb:MainMenuControl Grid.Row="0"> <dxb:BarButtonItem Content="File"/> <dxb:BarButtonItem Content="Settings"/> <dxb:BarButtonItem Content="Exit"/> </dxb:MainMenuControl> <TabControl Grid.Row="1"> <TabControl.Resources> <ControlTemplate x:Key="menuPresenterTemplate" TargetType="ContentControl"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--The following MainMenuControl belongs to the name scope implicitly defined for the Window. The Window's name scope is topmost.--> <dxb:MainMenuControl Grid.Row="0" x:Name="elementHost"/> <ContentPresenter Grid.Row="1"/> </Grid> </ControlTemplate> </TabControl.Resources> <!--Specify the InternalWithInternal merging behavior: a Tab's elements are only merged with other elements of the same Tab provided that they are defined in parent name scopes --> <TabItem Header="Tab 1" dxb:MergingProperties.ElementMergingBehavior="InternalWithInternal"> <ContentControl Template="{StaticResource menuPresenterTemplate}"> <StackPanel> <!--control 1--> <!--Explicitly define a name scope for the StackPanel.--> <!--Elements of this container will be merged to the 'elementHost' MainMenuControl, as it is defined in the parent name scope--> <StackPanel dxb:BarNameScope.IsScopeOwner="True"> <dxb:MainMenuControl> <dxb:BarButtonItem Content="Cut"/> <dxb:BarButtonItem Content="Copy"/> <dxb:BarButtonItem Content="Paste"/> </dxb:MainMenuControl> <TextBox Text="Text 1"/> </StackPanel> <!--control 2--> <!--Explicitly define a name scope for the StackPanel.--> <!--Elements of this container will be merged to the 'elementHost' MainMenuControl, as it is defined in the parent name scope--> <StackPanel dxb:BarNameScope.IsScopeOwner="True"> <dxb:MainMenuControl> <dxb:BarButtonItem Content="Left"/> <dxb:BarButtonItem Content="Center"/> <dxb:BarButtonItem Content="Right"/> </dxb:MainMenuControl> <TextBox Text="Text 2"/> </StackPanel> </StackPanel> </ContentControl> </TabItem> <TabItem Header="Tab 2" dxb:MergingProperties.ElementMergingBehavior="InternalWithInternal"> <ContentControl Template="{StaticResource menuPresenterTemplate}"> <!--...--> </ContentControl> </TabItem> </TabControl> </Grid> </Window>
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/Resources/CodeExamples-501.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/Resources/CodeExamples-501.html
关键字: DevExpress WPF
评论列表
暂无评论
请谈谈你的看法 请使用IE或者Firefox浏览器,暂不支持Chrome!
慧都控件网为DevExpress界面控件的中国地区唯一正式授权经销商,正版控件销售公司,授权代理商,经销商及合作伙伴。
电话:400-700-1020
023-66090381
邮箱:sales@evget.com
相关资源
- DevExpress Winforms界面展示:仿Office的应用程序
- PDF、Word、Excel文档的预览及操作处理
- ASP.NET界面开发框架 | 附在线演示
- 手把手教你用官方汉化资源做汉化
- 用DevExpress做软件开发的优势在哪里?
- DevExpress Dashboard示例代码:运行时修改默认本地化资源
- WPF界面开发框架 | 附在线演示
- DevExpress v15.2有哪些值得关注的新变化?
- 利用WizardControl构建多步向导界面
- DevExpress v15.2帮助文档下载大全
- ASP.NET MVC GridView强悍的数据处理 | 附在线演示
- DevExpress WPF 15.2代码示例:如何实现只选中一个项目