随笔分类 -  WPF

摘要:1.1 基本 Trigger <Window.Resources> <Style TargetType="{x:Type CheckBox}"> <Style.Triggers> <Trigger Property="IsChecked" Value="true"> <Setter Property 阅读全文
posted @ 2021-09-05 17:15 zq爱生活爱代码 阅读(195) 评论(0) 推荐(0)
摘要:點擊會默認選擇這一行,但是如果點擊這一列使用了contentTemplate,則不會 <Window x:Class="WpfDemo.HierarchicalDataTemplateDemo1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml 阅读全文
posted @ 2021-09-05 16:44 zq爱生活爱代码 阅读(79) 评论(0) 推荐(0)
摘要:ControlTemplate 和 DataTemplate 都是派生自FrameworkTemplate, 这个类有 FindName 方法 访问内部的控件 也就是说只有我们获得了Template 就可以访问内部控件。 对于ControlTemplate,访问控件的Template属性即可。但是对 阅读全文
posted @ 2021-08-30 19:56 zq爱生活爱代码 阅读(84) 评论(0) 推荐(0)
摘要:注意 HierarchicalDataTemplate 作用的目标是 MenuItem的 Header <Window x:Class="WpfDemo.HierarchicalDataTemplateDemo1" xmlns="http://schemas.microsoft.com/winfx/ 阅读全文
posted @ 2021-08-28 05:33 zq爱生活爱代码 阅读(137) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.HierarchicalDataTemplateDemo1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micr 阅读全文
posted @ 2021-08-28 00:26 zq爱生活爱代码 阅读(156) 评论(0) 推荐(0)
摘要:将 Template 应用给应用目标有两种方法,一种是给每个控件设定Template/ContentTemplate/ItemsTemplate/CellTemplate,不想设定的就不设置。另外一种就是 整体应用,把Template设置到 某种指定的控件或者数据上 把ControlTemplate 阅读全文
posted @ 2021-08-27 22:51 zq爱生活爱代码 阅读(52) 评论(0) 推荐(0)
摘要:<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schem 阅读全文
posted @ 2021-08-23 23:45 zq爱生活爱代码 阅读(104) 评论(0) 推荐(0)
摘要:1. 添加 Properties 命名空间 2.Resources.resx 权限改为public <Window x:Class="WpfDemo.ResourceDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentat 阅读全文
posted @ 2021-08-22 23:54 zq爱生活爱代码 阅读(843) 评论(0) 推荐(0)
摘要:StaticResource DynamicResource 资源只是初始化的时候访问一次,使用 StaticResource 如果程式运行过程中还有可能改变的资源 使用 DynamicResource 修改时 只有修改 this.Resource["XXX"]="XXXXXX"; 阅读全文
posted @ 2021-08-22 23:34 zq爱生活爱代码 阅读(68) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.ResourceDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2 阅读全文
posted @ 2021-08-22 23:30 zq爱生活爱代码 阅读(45) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.CommandParameter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/win 阅读全文
posted @ 2021-08-15 15:48 zq爱生活爱代码 阅读(115) 评论(0) 推荐(0)
摘要:从表面看,逻辑流程是这样。但是实际上,流程很简单。 创建命令 将命令和命令源赋给指定控件 创建命令关联,将命令赋给命令关联,同时将判断 命令是否可执行 的事件,以及命令可执行时触发的事件 也赋给命令关联。(实际 这两个路由事件是命令目标发送的) <Window x:Class="WpfDemo.Ro 阅读全文
posted @ 2021-08-15 11:16 zq爱生活爱代码 阅读(57) 评论(0) 推荐(0)
摘要:记录自定义事件到每个节点的事件 <Window x:Class="WpfDemo.SelfDefinedRoutedEvent" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sch 阅读全文
posted @ 2021-08-11 08:27 zq爱生活爱代码 阅读(40) 评论(0) 推荐(0)
摘要:1.如果要設定value的值是整數,那么设定IsSnapToTickEnabled="True" 意思是调到刻度上,默认刻度间隔 TickFrequency="1" 2.可以自由设定刻度盘的显示 Ticks="0.5 1.0 1.5 3.0" 最好同时设定 Maximum 3.还可以设定刻度盘的高亮 阅读全文
posted @ 2021-08-03 15:35 zq爱生活爱代码 阅读(255) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.MultiBindingDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/win 阅读全文
posted @ 2021-07-31 17:32 zq爱生活爱代码 阅读(50) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.BindingValidationDemo3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.c 阅读全文
posted @ 2021-07-31 16:25 zq爱生活爱代码 阅读(113) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.BindingValidationDemo2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.c 阅读全文
posted @ 2021-07-31 13:43 zq爱生活爱代码 阅读(80) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.BindingValidationDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.co 阅读全文
posted @ 2021-07-29 20:32 zq爱生活爱代码 阅读(84) 评论(0) 推荐(0)
摘要:参照了官网,但是 Error样式还是花了不少时间 <Window x:Class="WpfDemo.BindingValidationDemo2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="h 阅读全文
posted @ 2021-07-29 20:30 zq爱生活爱代码 阅读(133) 评论(0) 推荐(0)
摘要:<Window x:Class="WpfDemo.BindingConverterDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com 阅读全文
posted @ 2021-07-29 16:46 zq爱生活爱代码 阅读(25) 评论(0) 推荐(0)