WPF-控件-层级控件-Menu-嵌套结构
2024-09-07 01:36:08
<?xml version="1.0" encoding="utf-8" ?>
<Data xmlns="">
<Operation Name="文件" Gesture="F">
<Operation Name="新建" Gesture="N">
<Operation Name="项目" Gesture="Control + P"/>
<Operation Name="网站" Gesture="Control + W"/>
<Operation Name="文档" Gesture="Control + D"/>
</Operation>
<Operation Name="保存" Gesture="S"/>
<Operation Name="打印" Gesture="P"/>
<Operation Name="退出" Gesture="X"/>
</Operation>
<Operation Name="编辑" Gesture="E">
<Operation Name="拷贝" Gesture="Control + C"/>
<Operation Name="剪切" Gesture="Control + X"/>
<Operation Name="粘贴" Gesture="Control + S"/>
</Operation>
</Data>
<Window x:Class="工具栏功能的样式.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<!--数据源-->
<XmlDataProvider x:Key="Ds" Source="Data.xml" XPath="Data/Operation"/>
<!--Operation模板-->
<HierarchicalDataTemplate DataType="Operation" ItemsSource="{Binding XPath=Operation}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding XPath=@Name}" Margin="10,0"/>
<TextBlock Text="{Binding XPath=@Gesture}"/>
</StackPanel>
</HierarchicalDataTemplate>
</Window.Resources>
<StackPanel>
<Menu ItemsSource="{Binding Source={StaticResource Ds}}"></Menu>
</StackPanel>
</Window>
最新文章
- [Xilinx]Modelsim独立仿真Vivado生成的PLL核
- PHP的CURL方法curl_setopt()函数案例介绍(抓取网页,POST数据)
- fstream使用简介
- JDK 1.5 1.6 override区别
- [cb] Assetbundle打包(一)
- nice和taskset命令
- HDU 1217 Arbitrage (Floyd)
- python list去重的方法
- java.lang.OutOfMemory总结分析
- 30 个 Python 语言的特点技巧
- javascript中this、apply、call、bind的用法和区别
- HttpClient4的使用,模拟浏览器登陆新浪微博,发表微博和文字+图片微博
- 用Vue自己造个组件轮子,以及实践背后带来的思考
- ---————for循环打印爱心
- 脑残式网络编程入门(四):快速理解HTTP/2的服务器推送(Server Push)
- python +百度语音识别+图灵对话
- 2017-2018-2 20155314《网络对抗技术》Exp3 免杀原理与实践
- 【iCore4 双核心板_ARM】例程三:EXTI中断输入实验——读取ARM按键状态
- 【函数】SAS宏的特殊字符引用【转载】
- python编码(七)