当前位置: 首页 > news >正文

基于ListBox制作一个好看的侧边菜单导航栏

1.代码实现

MainWindow.xaml 代码如下:

<Window x:Class="UIDamo_WPF.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:UIDamo_WPF"mc:Ignorable="d"Title="MainWindow" Height="450" Width="800" Background="#2b2b2b"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="130"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><Rectangle Fill="#111111"/><ListBox Margin="0 5 0 0" Background="Transparent" Foreground="White" BorderThickness="0" FontSize="16" Name="listMenu"><ListBox.ItemContainerStyle><Style TargetType="ListBoxItem"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="ListBoxItem"><StackPanel Height="35" Orientation="Horizontal" Background="Transparent" Name="container" Cursor="Hand"><Rectangle Fill="Green" VerticalAlignment="Stretch" Width="5" Visibility="Hidden" Name="leftSlideRectangle"/><ContentPresenter  VerticalAlignment="Center" Margin="15 0 0 0"/></StackPanel><ControlTemplate.Triggers><Trigger Property="IsSelected" Value="True"><Setter Property="Visibility" Value="Visible" TargetName="leftSlideRectangle"/><Setter Property="Background" Value="#3a3a3a" TargetName="container"/></Trigger><Trigger Property="IsMouseOver" Value="True"><Setter Property="Visibility" Value="Visible" TargetName="leftSlideRectangle"/><Setter Property="Opacity" Value="0.5" TargetName="leftSlideRectangle"/><Setter Property="Background" Value="#1a1a1a" TargetName="container"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style></ListBox.ItemContainerStyle><ListBoxItem  Content="首页"/><ListBoxItem  Content="用户管理"/><ListBoxItem  Content="权限设置"/><ListBoxItem  Content="菜单管理"/><ListBoxItem  Content="配置管理"/><ListBoxItem  Content="设备管理"/><ListBoxItem  Content="数据管理"/><ListBoxItem  Content="系统配置"/><ListBoxItem  Content="基础配置"/><ListBoxItem  Content="退出系统"/></ListBox></Grid>
</Window>

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 【Agent】信息提取场景
  • 深入理解Android中的缓存与文件存储目录
  • IDEA的工程与模块管理
  • Laravel与现代前端:Vue.js与React的无缝集成
  • 如何定位Milvus性能瓶颈并优化
  • FPGA-ROM IP核的使用
  • 【数据结构】排序算法——Lessen1
  • 【味蕾盛宴】嘴尚绝健康与美味的完美融合
  • 服务器借助笔记本热点WIFI上网
  • 7月21日,贪心练习
  • 掌控视界:WebKit与CSS视口单位的卓越支持
  • 开源模型应用落地-FastAPI-助力模型交互-进阶篇-中间件(四)
  • 【LeetCode】对称二叉树
  • Android 10.0 Launcher3拖拽图标进入hotseat自适应布局功能实现一
  • pytorch 笔记:torch.optim(基类的基本操作)
  • 【腾讯Bugly干货分享】从0到1打造直播 App
  • AHK 中 = 和 == 等比较运算符的用法
  • Create React App 使用
  • DOM的那些事
  • gitlab-ci配置详解(一)
  • happypack两次报错的问题
  • JavaScript 无符号位移运算符 三个大于号 的使用方法
  • js
  • Linux各目录及每个目录的详细介绍
  • ReactNativeweexDeviceOne对比
  • Transformer-XL: Unleashing the Potential of Attention Models
  • 浮动相关
  • 猫头鹰的深夜翻译:Java 2D Graphics, 简单的仿射变换
  • 入职第二天:使用koa搭建node server是种怎样的体验
  • 数组的操作
  • 用Python写一份独特的元宵节祝福
  • 在Unity中实现一个简单的消息管理器
  • 06-01 点餐小程序前台界面搭建
  • 进程与线程(三)——进程/线程间通信
  • 如何正确理解,内页权重高于首页?
  • ​Python 3 新特性:类型注解
  • ​马来语翻译中文去哪比较好?
  • (02)vite环境变量配置
  • (2)关于RabbitMq 的 Topic Exchange 主题交换机
  • (html5)在移动端input输入搜索项后 输入法下面为什么不想百度那样出现前往? 而我的出现的是换行...
  • (iPhone/iPad开发)在UIWebView中自定义菜单栏
  • (Java)【深基9.例1】选举学生会
  • (solr系列:一)使用tomcat部署solr服务
  • (ZT)出版业改革:该死的死,该生的生
  • (深度全面解析)ChatGPT的重大更新给创业者带来了哪些红利机会
  • *setTimeout实现text输入在用户停顿时才调用事件!*
  • .NET/C# 阻止屏幕关闭,阻止系统进入睡眠状态
  • .net6解除文件上传限制。Multipart body length limit 16384 exceeded
  • .net安装_还在用第三方安装.NET?Win10自带.NET3.5安装
  • .pyc文件是什么?
  • @cacheable 是否缓存成功_Spring Cache缓存注解
  • [ vulhub漏洞复现篇 ] GhostScript 沙箱绕过(任意命令执行)漏洞CVE-2019-6116
  • [3D基础]理解计算机3D图形学中的坐标系变换
  • [5] CUDA线程调用与存储器架构
  • [ACTF2020 新生赛]Include