Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

VB
#Region "Constructor"
    Sub New()
        DefaultStyleKeyProperty.OverrideMetadata(GetType(DrawingCanvas), _
               New FrameworkPropertyMetadata(GetType(DrawingCanvas)))
.....

VB
Public Shared canvaseventproperty As DependencyProperty =   
  DependencyProperty.Register("canvasevent", GetType(selecteddrawingevent), GetType(DrawingCanvas), new propertymatadata()) ....


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!
Posted
Comments
Kenneth Haugland 28-Apr-13 6:01am    
You dont actually need it... Just delete the line and it will work just fine.
danait25 28-Apr-13 6:58am    
thanks- it works

1 solution

deleted that part from my constructor and it worked fine-

VB
'defaultStyleKeyProperty.OverrideMetadata(GetType(DrawingCanvas), _
              'New FrameworkPropertyMetadata(GetType(DrawingCanvas)))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900