如何在窗口商店应用程序C#中创建分部类后定义依赖项属性 [英] How can I define a dependency property after creating a partial class in window store app, C#
问题描述
我希望代码在Window Store App中创建分部类后定义依赖属性,C#(XAML)
我尝试过:
公共部分类MyControl:Control {public static readonly DependencyProperty StrokeThicknessProperty = DependencyProperty.Register(typeof(MyControl),new PropertyMetadata(2.0)); public double StrokeThickness {get {return(double)GetValue(StrokeThicknessProperty); } set {SetValue(StrokeThicknessProperty,value); }
I Want the codes to define a Dependency Property after creating a partial class in Window Store App, C#(XAML)
What I have tried:
public partial class MyControl : Control { public static readonly DependencyProperty StrokeThicknessProperty = DependencyProperty.Register( typeof(MyControl), new PropertyMetadata(2.0)); public double StrokeThickness { get { return (double)GetValue(StrokeThicknessProperty); } set { SetValue(StrokeThicknessProperty, value); } } }
推荐答案
请自己做一些研究。我已经为您提供了两个问题的链接。
Please do some research for yourself. I have already given you links for two of your questions.
这篇关于如何在窗口商店应用程序C#中创建分部类后定义依赖项属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!