WPF窗口模板——Style样式
通用模板,窗口样式
<!-- 通用窗口模板 -->
<ControlTemplate x:Key="CustomWindowTemplate" TargetType="Window">
<Border Margin="" CornerRadius="5,5,5,5" Background="#1BA1E2" MouseLeftButtonDown="CustomWindow_MouseLeftButtonDown">
<Border.Effect>
<DropShadowEffect BlurRadius="" RenderingBias="Performance" ShadowDepth="" Opacity=""/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=""></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="">
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"
Text="{TemplateBinding Title}" Foreground="#FFFFFF" FontSize=""></TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top">
<Button Height="" Width="" Content="-"
Style="{StaticResource ResourceKey=CustomWindowMenuBtn}" Click="CustomWindowBtnMinimized_Click" />
<Button Height="" Width="" Content="□"
Style="{StaticResource ResourceKey=CustomWindowMenuBtn}" Click="CustomWindowBtnMaxNormal_Click" />
<Button Height="" Width="" Content="×"
Style="{StaticResource ResourceKey=CustomWindowMenuBtn}" Click="CustomWindowBtnClose_Click" />
</StackPanel>
</Grid>
<Grid Grid.Row="">
<AdornerDecorator>
<ContentPresenter></ContentPresenter>
</AdornerDecorator>
</Grid>
</Grid>
</Border>
</ControlTemplate> <!-- 通用窗口样式 -->
<Style x:Key="CustomWindowChrome" TargetType="Window">
<Setter Property="AllowsTransparency" Value="True"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="WindowStyle" Value="None"></Setter>
<Setter Property="ResizeMode" Value="NoResize"></Setter>
<Setter Property="Template" Value="{StaticResource CustomWindowTemplate}"></Setter>
</Style>
- <!-- 通用窗口模板 -->
- <ControlTemplate x:Key="CustomWindowTemplate" TargetType="Window">
- <Border Margin="3" CornerRadius="5,5,5,5" Background="#1BA1E2" MouseLeftButtonDown="CustomWindow_MouseLeftButtonDown">
- <Border.Effect>
- <DropShadowEffect BlurRadius="3" RenderingBias="Performance" ShadowDepth="0" Opacity="1"/>
- </Border.Effect>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="50"></RowDefinition>
- <RowDefinition></RowDefinition>
- </Grid.RowDefinitions>
- <Grid Grid.Row="0">
- <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"
- Text="{TemplateBinding Title}" Foreground="#FFFFFF" FontSize="20"></TextBlock>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top">
- <Button Height="20" Width="20" Content="-"
- Style="{StaticResource ResourceKey=CustomWindowMenuBtn}" Click="CustomWindowBtnMinimized_Click" />
- <Button Height="20" Width="20" Content="□"
- Style="{StaticResource ResourceKey=CustomWindowMenuBtn}" Click="CustomWindowBtnMaxNormal_Click" />
- <Button Height="20" Width="20" Content="×"
- Style="{StaticResource ResourceKey=CustomWindowMenuBtn}" Click="CustomWindowBtnClose_Click" />
- </StackPanel>
- </Grid>
- <Grid Grid.Row="1">
- <AdornerDecorator>
- <ContentPresenter></ContentPresenter>
- </AdornerDecorator>
- </Grid>
- </Grid>
- </Border>
- </ControlTemplate>
- <!-- 通用窗口样式 -->
- <Style x:Key="CustomWindowChrome" TargetType="Window">
- <Setter Property="AllowsTransparency" Value="True"></Setter>
- <Setter Property="Background" Value="Transparent"></Setter>
- <Setter Property="WindowStyle" Value="None"></Setter>
- <Setter Property="ResizeMode" Value="NoResize"></Setter>
- <Setter Property="Template" Value="{StaticResource CustomWindowTemplate}"></Setter>
- </Style>
WPF窗口模板——Style样式的更多相关文章
- WPF 中的style 样式
WPF相较于以前学的WinForm,WPF在UI设计与动画方面的炫丽是最吸引我来学习的.在WPF中XMAL代码的引入使得代码的编写能够前后端分离,为获得更好的界面,也使得我们不得不分出一半的时间花在前 ...
- 自定义WPF 窗口样式
原文:自定义WPF 窗口样式 Normal 0 false 7.8 pt 0 2 false false false EN-US ZH-CN X-NONE 自定义 Window 在客户端程序中,经常需 ...
- 《Programming WPF》翻译 第5章 5.数据模板和样式
原文:<Programming WPF>翻译 第5章 5.数据模板和样式 让我们想象一下我们想要实现TTT更有娱乐性的一个版本(这是大部分游戏中最重要的特色).例如,TTT的一种变体允许玩 ...
- WPF笔记(1.9 样式和控件模板)——Hello,WPF!
原文:WPF笔记(1.9 样式和控件模板)--Hello,WPF! 资源的另一个用途是样式设置: <Window > <Window.Resources> <St ...
- 【WPF】MVVM动态修改Bingding的另一种思路——用Style样式
问题场景: 界面上有个ListBox控件,它的内容Item绑定了一个列表,即 ItemsSource =”{Binding StudentList}”.这个StudentList列表在该界面View对 ...
- WPF ScrollViewer(滚动条) 自定义样式表制作 (改良+美化)
原文:WPF ScrollViewer(滚动条) 自定义样式表制作 (改良+美化) 注释直接写在代码里了 不太理解意思的 可以先去看看我上一篇 WPF ScrollViewer(滚动条) 自定 ...
- WPF 日历模板改写
原文:WPF 日历模板改写 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/BYH371256/article/details/83346221 本 ...
- WPF 自定义键盘焦点样式(FocusVisualStyle)
WPF 自带的键盘焦点样式是与传统控件样式搭配的,但 WPF 凭着其强大的自定义样式的能力,做出与传统控件样式完全不同风格的 UI 简直易如反掌.这时,其自带的键盘焦点样式(FocusVisualSt ...
- WPF ListBoxItem模板中添加CheckBox选中问题
原文:WPF ListBoxItem模板中添加CheckBox选中问题 是这样的,需要一个ListBox来展示照片,并添加一个选中的CheckBox.这就需要对ListBox的ItemTemplate ...
随机推荐
- JavaScript实现StringBuffer
function StringBuffer() { this._strings = new Array(); } StringBuffer.prototype.Append = function(_s ...
- 虚拟环境--pipenv
1.安装pipenv,这个工具属于python3 升级pip : pip3 install pipenv 2.在项目中创建虚拟环境 3.激活虚拟环境,进入虚拟环境 进入虚拟环境之前: pipenv s ...
- 【U1结业机试题】新闻内容管理系统:解析XML文件读取Html模版生成网页文件
一.作业要求: 1.在xml文件中创建新闻节点news,包含标题.作者.日期.正文等信息 2.创建HTML模板文件 3.读取xml中所有新闻信息,并使用新闻信息替换模板文件中占位符,从而为每一条新闻生 ...
- Java线程同步打印ABC
需求: 三个线程,依次打印ABCABCABC.... 方案一: 使用阻塞队列,线程1从队列1获取内容打印,线程2从队列2获取内容打印,线程3从队列3中获取内容打印.线程1把B放到队列3中,线程2把C放 ...
- c#解析json字符串处理(最清晰易懂的方法)
注:博客迁移到csdn,本文最新地址:https://blog.csdn.net/sajiazaici/article/details/77647625 以下为原文 本文是全网第二简单的方法,因为我女 ...
- [转]chrome developer tool 调试技巧
这篇文章是根据目前 chrome 稳定版(19.0.1084.52 m)写的, 因为 google 也在不断完善chrome developer tool, 所以 chrome 版本不同可能稍有差别. ...
- SetupFactory7使用经验
1. exe默认产生快捷方式,可以点击去掉. 2. 默认英语,可与选汉语 3. 编码逻辑 安装程序复制完程序文件后,从编辑框中得到数据,并写ini文件 屏幕- ...
- vim右键粘贴 等杂
putty连上linux,vim编辑个文件,我去,右键不能用用上下面的命令,就好了. set mouse-=a 今天发现mysql倒入utf-8的文件网站显示出来都是乱码,不过用utf-8的控制台看是 ...
- 【阿里云产品公测】性能测试服务PTS初体验
作者:阿里云用户装甲兵 第一步,在九大产品免费公测 页面,点击性能测试服务PTS的申请公测按钮: 点击申请公测后,正确填写个人信息,免费申请性能测试服务PTS: 填写完成后,点击申请提交,耐心等待,一 ...
- ahp层次分析法软件
http://www.jz5u.com/Soft/trade/Other/58808.html 权重计算 归一化 本组当前数 - 本组最小 / 本组最大-本组最小 http://blog.csdn.n ...