I was developping an application lately and I needed to bind the “Enabled” property of a ToolStripButton to my Presenter. I failed to find any “DataSource” or “DataBindings” property. I then decided to make my own button without reinventing the wheel to enable this capability.
Here’s this simple class:
1 | public class ToolStripBindableButton : ToolStripButton, IBindableComponent |
Once you include this simple class inside your project/solution… you can easily convert any ToolStripButton into our new ToolStripBindableButton.
And I solved my problem like this:
1 | myBindableButton.DataBindings.Add("Enabled", myPresenter, "CanDoSomething"); |