DefaultStyleKeyProperty第二次 [英] DefaultStyleKeyProperty second time
问题描述
我用Kenneth Haugland推荐我这个工具:
WPF-Drawing-Canvas-Control
和我有一个问题,我想这很简单..
在类DrawingCanvas上有一个自定义控件
Hi,
I used this tool as Kenneth Haugland recommended me:
WPF-Drawing-Canvas-Control
and I have a problem that I guess is pretty simple..
On the class DrawingCanvas there''s a custom control
#Region "Constructor"
Sub New()
DefaultStyleKeyProperty.OverrideMetadata(GetType(DrawingCanvas), _
New FrameworkPropertyMetadata(GetType(DrawingCanvas)))
.... 。
.....
Public Shared canvaseventproperty As DependencyProperty =
DependencyProperty.Register("canvasevent", GetType(selecteddrawingevent), GetType(DrawingCanvas), new propertymatadata()) ....
在我的项目中,除了这一个窗口并且根据窗口中的一个选择的参数x,窗口drawingcanvascontrol打开,带有一张图片。
第一次没有问题,但是当我回到上一个窗口(x)并导航时到drawingcanvascontrol我收到此错误:
PropertyMetadata属性已经注册了类型''DrawingCanvas''
可能是什么问题?
谢谢!
In my project there''s more than this one window and according to a chosed param in window "x", the window "drawingcanvascontrol" opens with a certain picture.
On the first time there''s no problem but when I go back to the previous window ("x") and it navigates to "drawingcanvascontrol" I get this error:
"PropertyMetadata property is already registered for the type ''DrawingCanvas'' "
what may be the problem?
thanks!
推荐答案
删除了那部分从我的构造函数,它工作得很好 -
deleted that part from my constructor and it worked fine-
'defaultStyleKeyProperty.OverrideMetadata(GetType(DrawingCanvas), _
'New FrameworkPropertyMetadata(GetType(DrawingCanvas)))
这篇关于DefaultStyleKeyProperty第二次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!