I have created a demo of the PropertyGrid based on a tutorial online. Everything works except the TextAlign custom list I created. It shows in the PropertyGrid but the name is grayed out and no options in the value section. Can anyone see what is wrong?
Thanks,
Warren
Thanks,
Warren
Code:
Imports System.ComponentModel
<DefaultPropertyAttribute("Title")> _
Public Class ClassLabel
Private _Title As String
Private _Show As Boolean
Private _Number As Short
'''
<CategoryAttribute("Application"), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute(""), _
DesignOnly(False), _
DescriptionAttribute("Enter Title for the application")> _
Public Property Title() As String
Get
Return _Title
End Get
Set(ByVal Value As String)
_Title = Value
End Set
End Property
'''
<CategoryAttribute("Application"), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute("True"), _
DesignOnly(False), _
DescriptionAttribute("Show option")> _
Public Property Show() As Boolean
Get
Return _Show
End Get
Set(ByVal Value As Boolean)
_Show = Value
End Set
End Property
'''
<CategoryAttribute("Application"), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute("0"), _
DesignOnly(False), _
DescriptionAttribute("Enter a number")> _
Public Property Number() As Short
Get
Return _Number
End Get
Set(ByVal Value As Short)
_Number = Value
End Set
End Property
Private _ApplicationSize As Size
Private _ApplicationLocation As Point
Private _Font As System.Drawing.Font
Private _ForeColor As System.Drawing.Color
Private _BackColor As System.Drawing.Color
Private _Text As String
'''
<CategoryAttribute("Design"), _
Browsable(True), _
[ReadOnly](False), _
BindableAttribute(False), _
DefaultValueAttribute(""), _
DesignOnly(False), _
DescriptionAttribute("Enter text")> _
Public Property Text() As String
Get
Return _Text
End Get
Set(ByVal Value As String)
_Text = Value
End Set
End Property
Private _TextAlign As String
'''
<TypeConverter(GetType(TextAlign)), _
CategoryAttribute("Custom List"), DefaultValueAttribute(""), _
DescriptionAttribute("Select text align")> _
Public Property TextAlign() As String
Get
Return _TextAlign
End Get
Set(ByVal Value As String)
_TextAlign = Value
End Set
End Property
End Class
Public Class TextAlign : Inherits System.ComponentModel.StringConverter
Public Overloads Overrides Function GetStandardValues(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.ComponentModel.TypeConverter.StandardValuesCollection
Return New StandardValuesCollection(TextAlign)
End Function
Dim TextAlign As String() = New String() {"Left", "Center", "Right"}
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
Return True
End Function
End Class