使用附加属性增加控件属性,使得这个附加属性在使用的时候没有局限性,可以在任何的控件中使用它来增加所需要的属性,使得控件的属性使用起来非常灵活 一.自定义附加属性 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls;
先来总结下实现错误提示功能的几个要点 1:binding 的ValidationRules 2 :Validation.ErrorTemplate 首先我们在界面添加一个TextBox, Text绑定到people对象的属性age public class People { public int age { get; set; } public string name { get; set; } } <TextBox x:Name="textBox" HorizontalAlig