随笔分类 - WPF
摘要:Binding的ValidationRules 可以每个Binding 设置多个数据校验条件。下面创建一个规则,必须继承抽象类 ValidationRule,下面规则(0~100)public class RangeValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { double d = 0; i...
阅读全文
摘要:Binding 作为数据的桥梁,分为Binding的源(source)和目标(target)Binding是一种自动机制,当值变化后能通知,要实现需要在数据源的对象实现INotifyPropertyChanged接口 public class Student : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private string name; public string Name { g...
阅读全文
摘要:标记扩展一般含有 {} 符号x:Type 传入操作数据类型 x:Null 空值通过例子看下具体:(前台XAML代码)<Window x:Class="WpfApplication1.MainWindow" x:ClassModifier="public" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sy
阅读全文
摘要:x名称空间 包含的类均与解析xaml语言相关,也称"XAML名称空间"Attribute:x:Class (一般就指向后置代码)1、只能用于根结点2、根结点类型 必须与 x:Class 指向元素的类型一样3、x:Class 指向的类型必须使用partial 关键字x:ClassModifier修饰 x:Class 的访问级别 默认 Public 两者必须一致x:Name XAML 是声明式语言, 标签声明的是对象, 类是引用类型,一般是“引用者->实例"所有的控件都继承 FrameworkElement 所以具有 Name属性但是可能存在其他类,为了引用实例
阅读全文
摘要:<Window x:Class="FirstDemo.WindowABC" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:System.Windows.Controls;assembly=PresentationFramework" Title="MainWin
阅读全文


浙公网安备 33010602011771号