[Mono-bugs] [Bug 79678][Wis] New - Propertygrid is ignoring properties from typeconverters

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Oct 16 17:29:27 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by classdevelopment at a-softtech.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79678

--- shadow/79678	2006-10-16 17:29:27.000000000 -0400
+++ shadow/79678.tmp.5361	2006-10-16 17:29:27.000000000 -0400
@@ -0,0 +1,84 @@
+Bug#: 79678
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: ClassDevelopment at A-SoftTech.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Propertygrid is ignoring properties from typeconverters
+
+It seems as if Propertygrid is ignoring properties from (custom) 
+typeconverters. The attached image shows a comparison between MS and Mono.
+
+The following code shows a simple custom typeconverter:
+Imports System.Drawing
+Imports System.ComponentModel
+Imports ASoft.Graphics.Charts
+
+Namespace ASoft.Graphics.Charts
+	Public Class ShadowConverter
+		Inherits TypeConverter
+
+		Public Overloads Overrides Function CanConvertFrom(ByVal 
+context As System.ComponentModel.ITypeDescriptorContext, ByVal sourceType 
+As System.Type) As Boolean
+			If sourceType Is GetType(String) Then
+				Return False
+			End If
+			Return MyBase.CanConvertFrom(context, sourceType)
+		End Function
+
+		Public Overloads Overrides Function CanConvertTo(ByVal 
+context As System.ComponentModel.ITypeDescriptorContext, ByVal 
+destinationType As System.Type) As Boolean
+			If destinationType Is GetType(String) Then
+				Return True
+			End If
+			Return MyBase.CanConvertTo(context, 
+destinationType)
+		End Function
+
+		Public Overloads Overrides Function ConvertFrom(ByVal 
+context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As 
+System.Globalization.CultureInfo, ByVal value As Object) As Object
+			'TODO add ConvertFrom
+			Return MyBase.ConvertFrom(context, culture, value)
+		End Function
+
+		Public Overloads Overrides Function ConvertTo(ByVal 
+context As System.ComponentModel.ITypeDescriptorContext, ByVal culture As 
+System.Globalization.CultureInfo, ByVal value As Object, ByVal 
+destinationType As System.Type) As Object
+			If destinationType Is GetType(String) Then
+				Dim S As Shadow = CType(value, Shadow)
+				Return "Shadow: " & S.Type.ToString 
+& "; " & S.Color.ToString & "; " & S.Size.ToString
+			End If
+			Return MyBase.ConvertTo(context, culture, value, 
+destinationType)
+		End Function
+
+		Public Overloads Overrides Function GetPropertiesSupported
+(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
+			Return True
+		End Function
+
+		Public Overloads Overrides Function GetProperties(ByVal 
+context As System.ComponentModel.ITypeDescriptorContext, ByVal value As 
+Object, ByVal attributes() As System.Attribute) As 
+System.ComponentModel.PropertyDescriptorCollection
+			Dim properties As PropertyDescriptorCollection = 
+TypeDescriptor.GetProperties(GetType(ASoft.Graphics.Charts.Shadow))
+			Return properties
+		End Function
+	End Class
+End Namespace


More information about the mono-bugs mailing list