<%-- Name: WPF 依赖属性 Author: Dxq Description: 生成WPF的依赖属性 --%> <%@ Template Language="C#" TargetLanguage="Text" %> <%@ Property Name="PropertyName" Default="PropertyName" Type="System.String" Description="属性名称"%> <%@ Property Name="PropertyType" Default="object" Type="System.String" Description="属性类型"%> <%@ Property Name="ClassName" Default="ClassName" Type="System.String" Description="类的名称"%> /// <summary> /// 依赖属性 TODO:添加注释 /// </summary> public static readonly DependencyProperty <% = PropertyName %>Property = DependencyProperty.Register("<% = PropertyName %>", typeof(<% = PropertyType %>), typeof(<% = ClassName %>),null); /// <summary> /// 依赖属性 TODO:添加注释 /// </summary> public <% = PropertyType %> <% = PropertyName %> { get{ return (<% = PropertyType %>)GetValue(<% = PropertyName %>Property); } set{ SetValue(<% = PropertyName %>Property,value); } }
原文地址:https://www.cnblogs.com/sediment/p/8124477.html
时间: 2024-10-07 12:36:03