[CodeSmith] WPF依赖属性脚本
<%-- 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); } }