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 ...
随机推荐
- SQL脚本整理系列一 分隔函数
原来效果: fName Scroe 王某某 ,, 李某某 , 王某某 李某某 李某某 ,, 王某某 执行后效果: name score 李某某 李某某 李某某 王某某 王某某 王某某 王某某 王某某 ...
- SQL更新派工单数量=任务数量的
select b.FCommitQty '任务数量',a.FQty '派工数量',a.FSourceBillNo '派工单号',b.FBillNo '任务单号',a.FStatus '派工状态' fr ...
- JavaScript获取url参数
声明:以下内容转自网络 方法一 String.prototype.getUrlString = function(name) { var reg = new RegExp("(^|& ...
- 关于IQueryable和IEnumerable
园里对这两个已经有很多文章作了深入的介绍,我总结些,当成笔记用. 一.具体判断用哪个上,如果是运行在本地内存中的,用IEnumerable,枚举该对象时,会立即反应查询结果. 如果是远程数据源,比如数 ...
- 译:面试投行的20个Java问题
原文链接:https://dzone.com/articles/var-work-in-progress 作者:Anghel Leonard 译者:沈歌 如果你需要准备面试,可以看一下这篇博客中20个 ...
- 1、Dubbo源码解析--Dubbo如何驱动Spring IOC容器并配合工作的?
首先Spring要注入自己的bean需要在Spring-provider.xml(提供者spring注入文件,名字可能不一样)添加bean注入,其中有dubbo的自定义标签,xml如何识别这些标签?拿 ...
- Highcharts - Bar Chart & Column Chart
1. 条形图(Bar Chart)需要的数据格式类型如下: ["Luke Skywalker", "Darth Vader", "Yoda" ...
- greenplum维护
1.用户管理 psql -d sea CREATE DATABASE BI; CREATE USER ubi WITH PASSWORD 'pwdbi' NOSUPERUSER; GRANT ALL ...
- SQL Server 2012安装配置(Part2 )
2 服务器安装 运行安装程序后,首先进入 SQL Server 安装中心.选择左侧导航树中的"安装"菜单项. 图2-1 SQL Server 安装中心 在右侧菜单中点击" ...
- php提示undefined index的几种解决方法
平时用$_post[''],$_get['']获取表单中参数时会出现Notice: Undefined index: -------- 我们经常接收表单POST过来的数据时报Undefined ind ...