views:

25

answers:

1

I have static class that has a bunch of static properties. When I try to bind the property to a BindingSource (in the UI), I can pick the static class as the DataSource, however, when I drop down the DataMember combo, there is nothing there.

Can I use a static property of a static class as a DataMember of a BindingSource?

I should mention that this is a Winforms project.

+1  A: 

No. Most data-binding uses System.ComponentModel / TypeDescriptor, which is intrinsically instance based. You could, however, shim the static properties through a dummy object if you really wanted.

Note that additional care should be taken re thread-safety of static properties, which may make them even less desirable for direct data-binding. (or better: the use of mutable static properties should be heavily limited)

Marc Gravell
Thanks. The static properties are safely shielded from thread-safety shenanigans.
AngryHacker