Public Form property not shown in Property editor


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I have a couple of properties, both of type Color, that I added to a form. They are public properties, I've set up a Category() and Description() and added ShouldSerialize/Reset methods for them. However, I can't get them to show up in the property editor (grid). I would have sworn that there wasn't anything special to get this to work, but I'm baffled. Any ideas what I could be doing wrong?



Here's the code:



Private _passingBackColor As Color = Color.LightGreen



''' <summary>

''' Define the color used to highlight items that have passing

''' scores.

''' </summary>

<Category("RAMS: Score Formatting") _

, Description("Define the color used to highlight passing scores in the list.")> _

Public Property PassingBackColor() As Color

Get

Return _passingBackColor

End Get

Set(ByVal value As Color)

_passingBackColor = value

End Set

End Property



Private _failingBackColor As Color = Color.LightPink



''' <summary>

''' Define the color used to highlight items that have failing

''' scores.

''' </summary>

<Category("RAMS: Score Formatting") _

, Description("Define the color used to highlight failing scores in the list.")> _

Public Property FailingBackColor() As Color

Get

Return _failingBackColor

End Get

Set(ByVal value As Color)

_failingBackColor = value

End Set

End Property



''' <summary>

''' Return if the designer should serialize the PassingBackColor

''' property.

''' </summary>

''' <returns>True if property needs to be serialized to the designer</returns>

''' <remarks></remarks>

Public Function ShouldSerializePassingBackColor() As Boolean

Return _passingBackColor <> Color.LightGreen

End Function



''' <summary>

''' Reset the PassingBackColor to its default value and remove serialization

''' the property from the designer.

''' </summary>

''' <remarks></remarks>

Public Sub ResetPassingBackColor()

_passingBackColor = Color.LightGreen

End Sub



''' <summary>

''' Return if the designer should serialize the FailingBackColor

''' property.

''' </summary>

''' <returns>True if property needs to be serialized to the designer</returns>

''' <remarks></remarks>

Public Function ShouldSerializeFailingBackColor() As Boolean

Return _failingBackColor = Color.LightPink

End Function



''' <summary>

''' Reset the FailingBackColor to its default value and remove serialization

''' the property from the designer.

''' </summary>

''' <remarks></remarks>

Public Sub ResetFailingBackColor()

_failingBackColor = Color.LightPink

End Sub

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Greg.

Not sure this is the cause, but I define the DescriptionAttribute, not the Description, as you are coding over there:

''' <summary>
''' Define the color used to highlight items that have passing
''' scores.
''' </summary>
<Category("RAMS: Score Formatting") _
  , DescriptionAttribute("Define the color used to highlight passing scores in the list.")> _
Public Property PassingBackColor() As Color
    Get
        Return _passingBackColor
    End Get
    Set(ByVal value As Color)
        _passingBackColor = value
    End Set
End Property


Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)StrataFrame VIP (1.5K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Here is what works for me.

    <Category("Airbase: Custom Settings")> _
    <Description("When set to False, form data hotkeys will be disabled.")> _
    <DefaultValue(True)> _
    Public Property UseAppHotKeys() As Boolean
        Get
            Return Me.p_UseAppHotKeys
        End Get
        Set(ByVal value As Boolean)
            Me.p_UseAppHotKeys = value
        End Set
    End Property

Keith Chisarik

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
It looks correct.  If you are adding the properties to a class and then going into the designer of the same class, the properties will not show up.  However, if you drop the control on a different designer (i.e. drop a textbox on a form) or subclass the class, they will then show up on the inherited class within the designer.  Past that, the only other reason that I could think of is if the class in question is private or the heirarchy above these properties is hiding them due to their limited declaration.  Past that, I don't see anything blaring at me.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
OK, I think Trent has the answer. I didn't know that properties of a class didn't show up on that same class (in this case a form). I had added the properties to a form and then looked for those properties on that same form in the designer. If I understand you correctly, they would only show up for inherited forms or in the case of components or controls when dropped onto another container control. Is that correct?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You got it Wink
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks! Mystery solved! w00t
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search