Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Source Code Not Updating on ExpandableObject Converter
 

Source Code Not Updating on ExpandableObject Converter

Hello all...

I am having an issue with an expandableobjectconverter. My source code in the VS2005 designer is not updating, and I think it may have something to do with the ICustomTypeDescriptor. It works fine in the property grid, but when I look at the underlying source code, it is not there!

Any help is greatly appreciated.

Jason


Please find the parent class below (shortened for easier viewing):


<TypeConverter(GetType(ExpandableObjectConverter))> _
Public Class xMessageBox
Implements ICustomTypeDescriptor

#Region "Descriptor"

Public Function GetProperties(ByVal filter As Attribute()) As PropertyDescriptorCollection Implements ICustomTypeDescriptor.GetProperties

Dim i As Integer = 0

Dim baseProps As PropertyDescriptorCollection = TypeDescriptor.GetProperties(Me, True)
Dim newProps As New ArrayList
Dim prop As PropertyDescriptor
For Each prop In baseProps
newProps.Add(New PropDescriptor(prop, filter))
Next prop
Dim propArray As PropertyDescriptor() = CType(newProps.ToArray(GetType(PropertyDescriptor)), PropertyDescriptor())
Return New PropertyDescriptorCollection(propArray)
End Function

Public Function GetAttributes() As System.ComponentModel.AttributeCollection Implements ICustomTypeDescriptor.GetAttributes
Return TypeDescriptor.GetAttributes(Me, True)
End Function

Public Function GetClassName() As String Implements ICustomTypeDescriptor.GetClassName
Return TypeDescriptor.GetClassName(Me, True)
End Function

Public Function GetComponentName() As String Implements ICustomTypeDescriptor.GetComponentName
Return TypeDescriptor.GetComponentName(Me, True)
End Function

Public Function GetConverter() As TypeConverter Implements ICustomTypeDescriptor.GetConverter
Return TypeDescriptor.GetConverter(Me, True)
End Function

Public Function GetDefaultEvent() As EventDescriptor Implements ICustomTypeDescriptor.GetDefaultEvent
Return TypeDescriptor.GetDefaultEvent(Me, True)
End Function

Public Function GetEvents(ByVal attributes() As Attribute) As EventDescriptorCollection Implements ICustomTypeDescriptor.GetEvents
Return TypeDescriptor.GetEvents(Me, attributes, True)
End Function

Public Function GetEvents() As EventDescriptorCollection Implements ICustomTypeDescriptor.GetEvents
Return TypeDescriptor.GetEvents(Me, True)
End Function

Public Function GetDefaultProperty() As PropertyDescriptor Implements ICustomTypeDescriptor.GetDefaultProperty
Return TypeDescriptor.GetDefaultProperty(Me, True)
End Function

Public Function GetProperties() As PropertyDescriptorCollection Implements ICustomTypeDescriptor.GetProperties
Return TypeDescriptor.GetProperties(Me, True)
End Function

Public Function GetEditor(ByVal editorbasetype As Type) As Object Implements ICustomTypeDescriptor.GetEditor
Return TypeDescriptor.GetEditor(Me, editorbasetype, True)
End Function

Public Function GetPropertyOwner(ByVal pd As PropertyDescriptor) As Object Implements ICustomTypeDescriptor.GetPropertyOwner
Return
Me
End Function

#End Region

#Region "Initialize"
Dim xHyperLink As New xHyperLink
#End Region

#Region "Property"

'Hyperlink<Browsable(True)> <Category(" xImage Navigation")> <Description("Blah Blah.")> _
Public ReadOnly Property HyperLink() As xHyperLink
Get
Return xHyperLink
End
Get
End Property

End Class


And Here Is The Child Class



TypeConverter(GetType(ExpandableObjectConverter))> _
Public Class xHyperLink
Implements ICustomTypeDescriptor

#Region "Descriptor"

Public Function GetProperties(ByVal filter As Attribute()) As PropertyDescriptorCollection Implements ICustomTypeDescriptor.GetProperties

Dim i As Integer = 0
Dim baseProps As PropertyDescriptorCollection = TypeDescriptor.GetProperties(Me, True)
Dim newProps As New ArrayList
Dim prop As PropertyDescriptor
For Each prop In baseProps
newProps.Add(
New PropDescriptor(prop, filter))
Next prop
Dim propArray As PropertyDescriptor() = CType(newProps.ToArray(GetType(PropertyDescriptor)), PropertyDescriptor())
Return New PropertyDescriptorCollection(propArray)
End Function

Public Function GetAttributes() As System.ComponentModel.AttributeCollection Implements ICustomTypeDescriptor.GetAttributes
Return TypeDescriptor.GetAttributes(Me, True)
End Function

Public Function GetClassName() As String Implements ICustomTypeDescriptor.GetClassName
Return TypeDescriptor.GetClassName(Me, True)
End Function

Public Function GetComponentName() As String Implements ICustomTypeDescriptor.GetComponentName
Return TypeDescriptor.GetComponentName(Me, True)
End Function

Public Function GetConverter() As TypeConverter Implements ICustomTypeDescriptor.GetConverter
Return TypeDescriptor.GetConverter(Me, True)
End Function

Public Function GetDefaultEvent() As EventDescriptor Implements ICustomTypeDescriptor.GetDefaultEvent
Return TypeDescriptor.GetDefaultEvent(Me, True)
End Function

Public Function GetEvents(ByVal attributes() As Attribute) As EventDescriptorCollection Implements ICustomTypeDescriptor.GetEvents
Return TypeDescriptor.GetEvents(Me, attributes, True)
End Function

Public Function GetEvents() As EventDescriptorCollection Implements ICustomTypeDescriptor.GetEvents
Return TypeDescriptor.GetEvents(Me, True)
End Function

Public Function GetDefaultProperty() As PropertyDescriptor Implements ICustomTypeDescriptor.GetDefaultProperty
Return TypeDescriptor.GetDefaultProperty(Me, True)
End Function

Public Function GetProperties() As PropertyDescriptorCollection Implements ICustomTypeDescriptor.GetProperties
Return TypeDescriptor.GetProperties(Me, True)
End Function

Public Function GetEditor(ByVal editorbasetype As Type) As Object Implements ICustomTypeDescriptor.GetEditor
Return TypeDescriptor.GetEditor(Me, editorbasetype, True)
End Function

Public Function GetPropertyOwner(ByVal pd As PropertyDescriptor) As Object Implements ICustomTypeDescriptor.GetPropertyOwner
Return Me
End Function

#End Region

#Region "Converter"

Public Overrides Function ToString() As String
Dim x As String
x = "Not Set"
Return x
End Function

#End Region

#Region "Initialize"
Dim xHyperlinkURL As String
Dim xTargetFrame As String
#End Region

#Region "Properties"

'Hyperlink URL

<Browsable(True)> <Description("fdfdffd")> <NotifyParentProperty(True)> <RefreshProperties(RefreshProperties.Repaint)> <Editor(GetType(System.Web.UI.Design.UrlEditor), GetType(System.Drawing.Design.UITypeEditor))> _

Public Property Hyperlink_URL() As String
Get
Return xFunction.CoalesceNull(xHyperlinkURL)
End Get

Set(ByVal value As String)
xHyperlinkURL = value
End Set

End Property

'Target Frame

<Editor(GetType(TargetEditor), GetType(System.Drawing.Design.UITypeEditor))> <Browsable(True)> <Description("fdfdfd")> <NotifyParentProperty(True)> <RefreshProperties(RefreshProperties.Repaint)> _
Public Property Target_Frame() As String
Get
Return xFunction.CoalesceNull(xTargetFrame)
End Get
Set(ByVal value As String)
xTargetFrame = value
End Set

End Property

#End Region

End Class

ImaginationX  Wednesday, November 15, 2006 8:48 PM
You mean the correct constructor is not being called? An override of ConvertTo method of TypeConverter should be used to direct it to use the correct constructor for code generation
joeycalisay  Tuesday, November 21, 2006 10:46 AM

You can use google to search for other answers

Custom Search

More Threads

• designer on derived controls
• Populating comboboxes from eachother
• Visual Studio is not adding a .resx with a form...
• Can't add user control to form
• TreeView scrolling
• Remove Drawing Events - C#,Windows Application
• Combobox does not access key stroke
• FlowLayoutPanel.GetPreferredSize() not working as expected in design mode
• User control in designer
• currencyformat in textbox winforms