WPF自定义漂亮顶部工具栏 WPF自定义精致最大化关闭工具栏 wpf导航栏自定义 WPF快速开发工具栏

这篇具有很好参考价值的文章主要介绍了WPF自定义漂亮顶部工具栏 WPF自定义精致最大化关闭工具栏 wpf导航栏自定义 WPF快速开发工具栏。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

在WPF应用程序开发中,自定义一个漂亮的顶部工具栏具有多重关键作用,它不仅增强了用户体验,还提升了整体应用的专业性和易用性。以下是对这一功能的详细介绍:

首先,自定义顶部工具栏是用户界面设计的重要组成部分,它集成了应用程序的核心操作入口,如关闭、最大化和最小化窗口按钮,这些直观而易于识别的控件赋予了用户对窗口状态的完全控制权,使他们能够轻松调整窗口大小或退出程序。

其次,工具栏的灵活性体现在其强大的内容承载能力上,开发者可以自由地将Menu菜单项、图片、图标甚至是复杂的数据可视化组件嵌入其中,从而实现快捷访问常用功能、展示重要信息或提供动态数据概览等目的。这种高度定制化的布局有助于根据特定应用场景和用户需求量身打造高效的交互方式。

再者,通过运用WPF强大的样式和模板机制,开发者能够创建出拥有独特视觉效果的工具栏,例如背景色渐变、动态动画等高级UI效果。这样的个性化设计不仅能凸显应用的品牌特色,还能营造舒适的操作环境,提高用户的使用愉悦感和软件的吸引力。

最后,优雅且功能齐全的顶部工具栏对于提升首屏界面的重要性不言而喻。它作为用户与应用程序互动的第一道门面,精心设计的工具栏有助于引导用户快速定位功能模块,简化操作流程,降低认知负荷,并彰显应用的精致品质和人性化考量。

WPF中自定义的漂亮顶部工具栏不仅是技术实力的展现,更是提升用户体验、塑造品牌形象和优化交互逻辑的关键设计元素之一,它的存在极大地影响着用户对整个应用程序的第一印象及长期使用的满意度。

下载源代码

WPF自定义漂亮顶部工具栏 WPF自定义精致最大化关闭工具栏 wpf导航栏自定义 WPF快速开发工具栏,WPF,wpf,WPF漂亮工具栏,WPF漂亮顶部工具栏,WPF顶部工具栏,WPF自定义顶部工具栏,WPF自定义最大化最小化关闭文章来源地址https://www.toymoban.com/news/detail-791509.html

<Window x:Class="headBeautiful.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:hc="https://handyorg.github.io/handycontrol"
        xmlns:local="clr-namespace:headBeautiful"
        mc:Ignorable="d"
        WindowStyle="None"
        WindowStartupLocation="CenterScreen"
        WindowState="Maximized"
        Loaded="Window_Loaded"
        MouseLeftButtonDown="Window_MouseLeftButtonDown"
        Title="MainWindow" Height="850" Width="1200">
    <WindowChrome.WindowChrome>
        <WindowChrome CaptionHeight="0" ResizeBorderThickness="5"/>
    </WindowChrome.WindowChrome>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="300" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.Background>
                <LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
                    <GradientStop Offset="0" Color="#CCD5F0"/>
                    <GradientStop Offset="1" Color="#C4E2EC"/>
                </LinearGradientBrush>
            </Grid.Background>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="200"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
                <TextBlock Text="导航页" Foreground="#5a5e66" FontSize="16" FontWeight="Bold" Margin="15 0 0 0"/>
            </StackPanel>
            <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                <Border BorderBrush="#5a5e66" BorderThickness="1" CornerRadius="5" Background="#FFFFFF" >
                    <Menu Background="Transparent" FontSize="14" VerticalAlignment="Center" BorderThickness="0" BorderBrush="Transparent">
                        <MenuItem Header="微软" Foreground="#5a5e66" />
                        <MenuItem Header="Google" Foreground="#5a5e66" />
                        <MenuItem Header="苹果" Foreground="#5a5e66" />
                        <MenuItem Header="小米" Foreground="#5a5e66" />
                        <MenuItem Header="联系" Foreground="#5a5e66" />
                        <MenuItem Header="退出" Foreground="#5a5e66" />
                    </Menu>
                </Border>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right">
                <Button Style="{StaticResource ButtonIcon}" Foreground="#5a5e66"  x:Name="MinWin" Click="MinWin_Click"
                            hc:IconElement.Geometry="{StaticResource WindowMinGeometry}" Visibility="Visible"/>
                <Button Style="{StaticResource ButtonIcon}" Foreground="#5a5e66"  x:Name="MaxWin" Click="MaxWin_Click"
                            hc:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" Margin="0 0 10 0"/>
                <Button Style="{StaticResource ButtonIcon}" Foreground="#5a5e66"  x:Name="MaxWin2" Click="MaxWin2_Click"
                            hc:IconElement.Geometry="{StaticResource WindowMaxGeometry}" Margin="0 0 10 0"/>
                <Button Style="{StaticResource ButtonIcon}" Foreground="#5a5e66" x:Name="Close" Click="Close_Click"
                        hc:IconElement.Geometry="{StaticResource CloseGeometry}" Margin="0 0 10 0"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="1*" />
                <RowDefinition Height="1*" />
            </Grid.RowDefinitions>
            <!--这两个broder是背景-->
            <Border Background="#409eff" Grid.Row="0"/>
            <Border Background="#F9F9FC" Grid.Row="1"/>

            <UniformGrid Grid.Row="0" Grid.RowSpan="2" Columns="3" Margin="0 40 0 40">

                <Border Margin="15" CornerRadius="5">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
                            <GradientStop Offset="0" Color="#FF8C69"/>
                            <GradientStop Offset="1" Color="#FF7000"/>
                        </LinearGradientBrush>
                    </Border.Background>

                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition Height="2*"/>
                        </Grid.RowDefinitions>

                        <TextBlock Text="Stock Total" Grid.Row="1" VerticalAlignment="Center" FontSize="16" Margin="10 0 0 0" Foreground="White"/>
                        <TextBlock Text="$150000" FontWeight="Bold" VerticalAlignment="Center" Grid.Row="2" FontSize="22" Margin="10 0 0 0" Foreground="White"/>
                        <TextBlock Text="Incrased by 60%" Grid.Row="3" FontSize="20" Foreground="White" Margin="10 0 0 0" VerticalAlignment="Center"/>

                        <Canvas ClipToBounds="True" Grid.RowSpan="4">
                            <Border Canvas.Right="-40" Canvas.Top="10" Grid.RowSpan="4" Width="110" Height="110"  CornerRadius="100" Background="#ffffff" Opacity="0.2" VerticalAlignment="Top"  HorizontalAlignment="Right"/>
                            <Border Canvas.Right="-10" Canvas.Top="100" Grid.RowSpan="4" Width="110" Height="110" CornerRadius="100" Background="#ffffff" Opacity="0.2" VerticalAlignment="Bottom"  HorizontalAlignment="Right"/>
                        </Canvas>

                    </Grid>

                </Border>

                <Border Margin="15" CornerRadius="5">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
                            <GradientStop Offset="0" Color="#FFD700"/>
                            <GradientStop Offset="1" Color="#FFC100"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition Height="2*"/>
                        </Grid.RowDefinitions>

                        <TextBlock Text="Total Proflt" Grid.Row="1" VerticalAlignment="Center" FontSize="16" Margin="10 0 0 0" Foreground="White"/>
                        <TextBlock Text="$250000" FontWeight="Bold" VerticalAlignment="Center" Grid.Row="2" FontSize="22" Margin="10 0 0 0" Foreground="White"/>
                        <TextBlock Text="Incrased by 30%" Grid.Row="3" FontSize="20" Foreground="White" Margin="10 0 0 0" VerticalAlignment="Center"/>


                        <Canvas ClipToBounds="True" Grid.RowSpan="4">
                            <Border Canvas.Right="-40" Canvas.Top="10" Grid.RowSpan="4" Width="110" Height="110"  CornerRadius="100" Background="#ffffff" Opacity="0.2" VerticalAlignment="Top"  HorizontalAlignment="Right"/>
                            <Border Canvas.Right="-10" Canvas.Top="100" Grid.RowSpan="4" Width="110" Height="110" CornerRadius="100" Background="#ffffff" Opacity="0.2" VerticalAlignment="Bottom"  HorizontalAlignment="Right"/>
                        </Canvas>

                    </Grid>
                </Border>

                <Border Margin="15" CornerRadius="5">
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,1" EndPoint="1,1">
                            <GradientStop Offset="0" Color="#00CED1"/>
                            <GradientStop Offset="1" Color="#59E6B5"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition Height="2*"/>
                        </Grid.RowDefinitions>

                        <TextBlock Text="Unique Visitors" Grid.Row="1" VerticalAlignment="Center" FontSize="16" Margin="10 0 0 0" Foreground="White"/>
                        <TextBlock Text="$250000" FontWeight="Bold" VerticalAlignment="Center" Grid.Row="2" FontSize="22" Margin="10 0 0 0" Foreground="White"/>
                        <TextBlock Text="Incrased by 80%" Grid.Row="3" FontSize="20" Foreground="White" Margin="10 0 0 0" VerticalAlignment="Center"/>

                        <Canvas ClipToBounds="True" Grid.RowSpan="4">
                            <Border Canvas.Right="-40" Canvas.Top="10" Grid.RowSpan="4" Width="110" Height="110"  CornerRadius="100" Background="#ffffff" Opacity="0.2" VerticalAlignment="Top"  HorizontalAlignment="Right"/>
                            <Border Canvas.Right="-10" Canvas.Top="100" Grid.RowSpan="4" Width="110" Height="110" CornerRadius="100" Background="#ffffff" Opacity="0.2" VerticalAlignment="Bottom"  HorizontalAlignment="Right"/>
                        </Canvas>
                    </Grid>
                </Border>


            </UniformGrid>

        </Grid>

    </Grid>
</Window>

到了这里,关于WPF自定义漂亮顶部工具栏 WPF自定义精致最大化关闭工具栏 wpf导航栏自定义 WPF快速开发工具栏的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • CKEditor5+vue3使用以及如何添加新工具栏,自定义设置字体fontFamily

    官网地址:https://ckeditor.com/ckeditor-5/online-builder/ 官网提供了以下几种模式,一般使用经典模式居多,具体差别可访问官网自己试一下。 基本的使用方法(经典模式),先别急着操作,看完再决定使用哪种方法。 代码 效果如图 以上基本的工具栏配置比较少,如果基本的满足你的

    2024年02月10日
    浏览(45)
  • vue3使用工作流bpmn.js实现保存 ,新增,修改 ,右边工具栏自定义,属性栏自定义

    vue3使用工作流bnpm.js实现保存 ,新增,修改 ,右边工具栏自定义,属性栏自定义

    2024年02月13日
    浏览(23)
  • [QT编程系列-7]:C++图形用户界面编程,QT框架快速入门培训 - 3- QT窗体设计 - 自定义工具栏、状态栏、快捷键、图标

    目录 3. QT窗体设计 3.2 自定义工具栏 3.2.1 目标 3.2.2 实现过程 3.2 自定义状态栏 3.2.1  目标 3.2.2  过程 3.3 自定义动作快捷键 3.4 自定义图标 在Qt中,ToolBar(工具栏)是一种常见的GUI元素,用于提供应用程序的常用工具按钮和操作。工具栏通常包含一系列图标按钮,用于执

    2024年02月15日
    浏览(33)
  • 【IntelliJ IDEA】怎么调整工具栏的工具图标,比如在工具栏显示git push按钮

    演示版本为2019.1.1 想调整一下IDEA的工具栏图标,但是搜了一下,都感觉说的不是很完整,或者跟着步骤却没有任何效果,以下是个人使用的一些经验,希望可以帮到你 如果你是想在View - ToolBar中的工具栏添加按钮,也就是这一栏 比如我的git 原本是没有push按钮的,该怎么添加

    2024年02月11日
    浏览(47)
  • Qt之菜单栏、工具栏、状态栏介绍及工具栏QAction的动态增删显示实现方式

    目的 端应用程序或者编辑器基本都支持工具栏快捷功能的动态增删,即通过在菜单栏上打钩就可以在工具栏上看到相应功能的快捷按钮,取消打钩则在工具栏上就移除了该功能的快捷按钮。那么Qt如何实现这个功能,本篇目的就是记录实现此功能的方法及思路。 效果 先看下

    2024年02月08日
    浏览(30)
  • 16.Qt 工具栏生成

    目录 前言: 技能: 内容: 1. 界面添加 2. 信号槽  功能实现 参考: 前言: 基于QMainWindow ,生成菜单下面的工具栏,可以当作菜单功能的快捷键,也可以完成新的功能 直接在UI文件中生成 技能: 创建工具栏 内容: 基于QMainWindow!!!创建时基类选择QMainWindow 1. 界面添加 菜

    2024年02月19日
    浏览(31)
  • Android工具栏ToolBar

    主流APP除了底部有一排标签栏外,通常顶部还有一排导航栏。在Android5.0之前,这个顶部导航栏以ActionBar控件的形式出现,但AcionBar存在不灵活、难以扩展等毛病,所以Android5.0之后推出了 ToolBar工具栏 控件,意在取代AcionBar。 但为了兼容之前的版本,ActionBar按件仍然保留。 T

    2024年02月05日
    浏览(34)
  • idea上方工具栏调整位置

    一,点进去idea发现在上方的工具栏那里所有的工具都消失了,如下图所示,Tomcat服务器,包括安装的一些插件都不显示了 二,解决办法:可能是由于自己不小心点到了某个按钮,按照下图操作再把它设置一下就行了,点view–appearance–Navigation bar 三,点Toolbar会把工具栏位置

    2024年02月15日
    浏览(32)
  • wangEditor系列之工具栏配置

    mode为default mode为simple 下方分别介绍对面得四个属性 结果如下 分组可以给key设置 | 斜体就不在工具栏展现了 如果你感觉文章不咋地 //(ㄒoㄒ)// ,就在评论处留言,作者继续改进; o_O??? 如果你觉得该文章有一点点用处,可以给作者点个赞; \\\\*^o^*// 如果你想要和作者一起进步

    2024年02月09日
    浏览(33)
  • Qt菜单栏,工具栏,状态栏

    ui界面增加不了控件,只能代码增加; ui-statusbar-setSizeGripEnabled(false);   void QStatusBar::addWidget(QWidget *widget, int stretch = 0) stretch参数用于随着状态栏的增长和收缩为给定的小部件计算合适的大小。默认的拉伸因子为0,即给小部件一个最小的空间。     

    2024年02月15日
    浏览(36)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包