Groups | Blog | Home
all groups > dotnet windows forms databinding > august 2006 >

dotnet windows forms databinding : IExtenderProvider and databinding


RJ
8/4/2006 10:22:18 AM
VS2005 data binding wizard will recognize and list the extended control
property 'MyProperty', which is defined and exposed via IExtenderProvider
component on the form. The databinding wizard allows you to choose this
control property and select a binding object property to bind to. In other
words, the data binding wizard seems to give every indication that you CAN
bind to extended control properties...

Runtime exception --> "Cannot bind to the property 'MyProperty' on the
target control.\r\nParameter name: PropertyName"

occurs on statement --> Me.MainForm = Global.Binding.Form1 inside the
Application.Desinger.vb OnCreateMainForm

I guess I am hoping someone can set me straight on this.... Can I OR can I
not apply databinding to a control property provided by an IExtenderProvider
component? If not, why doesn't the VS2005 wizard not indicate this? I may
be missing something here, but the wizard really got my hopes up.

Posted to 2 groups because the question relates to both.

Bob Powell [MVP]
8/7/2006 12:00:00 AM
The problem here lies in the mechanism used to provide properties at
design-time. Extender providers add property descriptors to the list of
properties of a specific type of object. At design-time these properties are
seen as any other property and there's no way to determine whether the
property is real or not. At runtime, the binding manager will search for a
property via reflection but the designer won't be running so the property
won't exist.

Under normal circumstances you cannot bind to a property provided by an
extender provider. There may however be a way of fooling it by using the new
TypeDescriptionProvider system. This would be an excersise for you to try
for yourself...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



[quoted text, click to view]

RJ
8/7/2006 10:19:18 AM
Thanks Bob. I will look into TypeDescriptionProvider.


[quoted text, click to view]

AddThis Social Bookmark Button