摘要: 模板选择器:根据内容可以自定义调用不同的模板 //模板选择器类 public class PersonDataTemplateSelector : DataTemplateSelector { public DataTemplate NormalTemplate { get; set; } publ 阅读全文
posted @ 2021-11-18 17:02 zyl2 阅读(251) 评论(0) 推荐(0)
摘要: 数据模板 数据模板实质上也是以内容模板为基础,在数据模板中,是对内容模板重复的显示,以达到迭代显示数据的作用,所以在数据模板中,可以添加呈现数据的任意元素。能够添加数据模板的元素,主要是继承自ItemsControl类的控件,通过控件的ItemTemplate属性来支持,比如我们常用的ListBox 阅读全文
posted @ 2021-11-18 16:59 zyl2 阅读(74) 评论(0) 推荐(0)
摘要: 控件模板: 控件模板可以对控件外观如何修饰,定义用ControlTemplate 如按钮的控件模板定义 <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="border" BorderBrush="#FF24C6F5" Bor 阅读全文
posted @ 2021-11-18 16:52 zyl2 阅读(86) 评论(0) 推荐(0)
摘要: EventSetter:当事件触发的时候会执行Handler的事件处理程序 样式的触发器: 使用触发器可自动完成简单的样式的改变,不需要使用代码,也可以完成不少工作。 触发器通过Style.Trigger集合链接到样式。每个样式可以有任意多个触发器。每个触发器都是System.Windows.Tri 阅读全文
posted @ 2021-11-18 16:39 zyl2 阅读(298) 评论(0) 推荐(0)
摘要: 样式定义 <Window.Resources> <Style x:Key="FocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="2" SnapsT 阅读全文
posted @ 2021-11-18 16:24 zyl2 阅读(169) 评论(0) 推荐(0)
摘要: 资源的加载 同一程序集下加载URI:"Pack://application:,,,/Images/Logo.png" 或者"/Images/Logo.png" 不同程序集下加载URI:"Pack://application:,,,/Zhaoxi.Assets;component/Images/Log 阅读全文
posted @ 2021-11-18 16:13 zyl2 阅读(300) 评论(0) 推荐(0)
摘要: public class BreakWrapPanel : Panel { public static readonly DependencyProperty IsBreakForceProperty = DependencyProperty.RegisterAttached("BreakForce 阅读全文
posted @ 2021-11-18 16:01 zyl2 阅读(48) 评论(0) 推荐(0)
摘要: 1.Border控件:是一种装饰控件,为控件添加边界 <Border BorderThickness="5,0,0,0" BorderBrush="Red" CornerRadius="5" > //BorderThickness定义边界的笔大小,BorderBrush边界颜色 CornerRadi 阅读全文
posted @ 2021-11-18 15:41 zyl2 阅读(101) 评论(0) 推荐(0)
摘要: wpf无边窗体实现有两种方式: 第一种: <Window x:Class="Zhaoxi.LayoutStudy.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:/ 阅读全文
posted @ 2021-11-18 15:24 zyl2 阅读(794) 评论(0) 推荐(0)