创建侧边栏 – 像WPF中的Windows桌面应用程序一样
发布时间:2020-12-14 03:58:27 所属栏目:Windows 来源:网络整理
导读:我想要做的是在 WPF中创建一个桌面应用程序,其UI是一个小图标将保持固定在屏幕左边缘的中心,点击(或可能悬停)将滑动打开侧边栏(如谷歌桌面栏)沿着屏幕的左边缘运行(固定位置,不能移动). 请注意,我要求的可能就像一个appbar但我不希望左侧边缘的桌面图标移动,
我想要做的是在
WPF中创建一个桌面应用程序,其UI是一个小图标将保持固定在屏幕左边缘的中心,点击(或可能悬停)将滑动打开侧边栏(如谷歌桌面栏)沿着屏幕的左边缘运行(固定位置,不能移动).
请注意,我要求的可能就像一个appbar但我不希望左侧边缘的桌面图标移动,因为它发生在appbar,即我不希望它占用桌面空间… .can有人请建议我出路吗? 我使用this实现了部分解决方案,但我无法获得幻灯片动画和固定位置到锻炼 解决方法
像这样的东西可以工作:
那么你当然可以为侧边栏创建动画幻灯片.这显示了(部分)透明度和切换原理. XAML: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStyle="None" Topmost="True" WindowState="Maximized" AllowsTransparency="True" Background="Transparent"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Rectangle Name="rect" Width="100" VerticalAlignment="Stretch" Fill="#99000000" Visibility="Collapsed" /> <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="32" Height="32" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right" Background="White" Click="Button_Click">></Button> </Grid> </Window> C#: private void Button_Click(object sender,RoutedEventArgs e) { if (rect.Visibility == System.Windows.Visibility.Collapsed) { rect.Visibility = System.Windows.Visibility.Visible; (sender as Button).Content = "<"; } else { rect.Visibility = System.Windows.Visibility.Collapsed; (sender as Button).Content = ">"; } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- wpf – 在Windows 8.1上使用WindowChrome时,任务栏图标消失
- 错误:不支持使用MSBuild 64位构建Windows Phone应用程序
- windows-vista – 导致Vista / Win7警告的原因:“此程序可
- windows – 删除DISM的重新启动请求
- windows 自定义批处理BAT/CMD启动Redis等软件
- Windows中的GetDesktopWindow和OpenInputDesktop API有什么
- 部署 – 如何将Windows-8企业应用程序部署到其他用户?
- windows – 使用带有Dell Perc 4e(LSI)的RAID时如何访问SMA
- microsoft-office-365 – 是否可以在Office 365上查看登录历
- Windows Server 2016-命令行方式管理Windows服务
推荐文章
站长推荐
- windows-installer – Techsmith Snagit的Window
- 如何在PowerShell中运行Windows安装程序并获取成
- microsoft sql server:检查用户自己的权限
- 在Windows 10中使用vb6进行webautomation时出错
- 在Windows上安装cygwin并启用ssh服务器的无人值守
- windows-server-2008 – 在Windows Server上连续
- Fix: Windows Script Host access is disabled o
- 如何在Windows中制作/比较文件系统/注册表快照?
- 检测从.NET调用的调用dll的崩溃
- windows-server-2008-r2 – 我在哪里授予权限,以
热点阅读