I'm using a property grid to display application properties and settings at run time.So I have a form with a property grid on it, and I set the SelectedObject to a new instance of my class. The class and it's methods are marked up with TypeConverters and UITypeEditors to provide a nice UI experience.

This works great, but I'd like to add designer verb support so that the user gets links in the commands pane of the property grid. I've written a Designer that inherits from ComponentDesigner, and I've marked up my class with a Designer() attribute. But when I run the project and show my form, no verbs display.

What am I missing - do verbs not display at run-time? Or do I need to inherit from something other than ComponentDesigner (since I'm not really writing a component per se...).

Any help would be appreciated.

Thanks!

Imports System.ComponentModel

Imports System.ComponentModel.Design

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.PropertyGrid1.SelectedObject = New Foobar

End Sub

End Class

<Designer(GetType(FoobarDesigner))> _

Public Class Foobar

Private _someProperty As String = String.Empty

Public Property SomeProperty() As String

Get

Return _someProperty

End Get

Set(ByVal value As String)

_someProperty = value

End Set

End Property

End Class

Public Class FoobarDesigner

Inherits System.ComponentModel.Design.ComponentDesigner

Public Overrides ReadOnly Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection

Get

Dim v As New DesignerVerb("Test Verb", AddressOf Me.Test)

Return New DesignerVerbCollection(New DesignerVerb() {v})

End Get

End Property

Private Sub Test(ByVal sender As Object, ByVal e As EventArgs)

MsgBox("Verb clicked!")

End Sub

End Class