WPF WindowChrome 自定义窗口
2017-06-28 15:20
302 查看
1.wpf自定义窗口:
WindowChrome类描述:https://msdn.microsoft.com/zh-cn/library/system.windows.shell.windowchrome.aspx
示例样式效果:
1.设置GlassFrameThickness=0 隐藏默认标题栏
2.最大化最小化不会盖住任务栏
WindowChrome类描述:https://msdn.microsoft.com/zh-cn/library/system.windows.shell.windowchrome.aspx
示例样式效果:
1.设置GlassFrameThickness=0 隐藏默认标题栏
2.最大化最小化不会盖住任务栏
<Window x:Class="WindowChromeTest.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:shell="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell" xmlns:local="clr-namespace:WindowChromeTest" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Style TargetType="local:MainWindow"> <Setter Property="shell:WindowChrome.WindowChrome"> <Setter.Value> <shell:WindowChrome CaptionHeight="50" GlassFrameThickness="0" CornerRadius="0" ResizeBorderThickness="2" ></shell:WindowChrome> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:MainWindow}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="50"></RowDefinition> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <Border Grid.Row="0" Background="Orange"> <StackPanel Orientation="Horizontal"> <Button shell:WindowChrome.IsHitTestVisibleInChrome="True" Content="Test Button" Click="Button_Click"></Button> </StackPanel> </Border> <Border Grid.Row="1" Background="White"> <ContentPresenter Content="{TemplateBinding Content}"></ContentPresenter> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <TextBlock Text="asdasdf"></TextBlock> </Window>
相关文章推荐
- WPF 之 创建继承自Window 基类的自定义窗口基类
- [WPF]使用WindowChrome自定义Window Style
- 【WPF】分享自用 白板窗口(空窗口) 控件 BlankWindow,基于WindowChrome。
- [WPF]使用WindowChrome自定义Window Style
- WPF窗口跳转及window和page区别
- WPF窗口跳转及window和page区别
- WPF学习笔记-自定义窗口
- [WPF疑难] 继承自定义窗口
- WPF程序设计 :第一章 应用程序和窗口(The Application and the Window)
- 自定义WPF 窗口样式{转}
- 解决弹出的窗口window.open会被浏览器阻止的问题(自定义open方法)
- [WPF疑难] 继承自定义窗口
- WPF自定义标题栏——窗口移动和按钮状态转换
- WPF中的窗口的生命周期[window]
- [转载]WPF窗口跳转及window和page区别
- WPF窗口跳转及window和page区别
- WPF继承自定义窗口
- [导入][WPF疑难] 继承自定义窗口
- WPF窗口跳转及window和page区别
- WPF 子窗口弹出并有回弹效果,自定义滚动条