title: Disable Infragistics Toolbar Button (ButtonTool)
body: <p>I need to Enable/Disable the ButtonTool.</p>
  
  <p>Before using Infragistics I used an ordinaly WinForms ToolbarButton, that have a property "Enabled".</p>
  
  <p>I used the databinding like this:</p>
  
  <pre><code>UndoButtonTool.DataBindings.Clear()
  UndoButtonTool.DataBindings.Add("Enabled", memory, "CanUndo")
  </code></pre>
  
  <p>How can I do now using the infragistics ButtonTool?</p>
  
  <p>doing</p>
  
  <pre><code>UndoButtonTool.DataBindings.Clear()
  UndoButtonTool.DataBindings.Add("SharedProps.Enabled", memory, "CanUndo")
  </code></pre>
  
  <p>will not work...</p>
  
  <p>I already implemented an custom BindableButtonTool:</p>
  
  <pre><code>Public Class ToolStripBindableButton
    Inherits Infragistics.Win.UltraWinToolbars.ButtonTool
    Implements IBindableComponent
  
    Private _DataBindings As ControlBindingsCollection
    Private _BindingContext As BindingContext
    Private _Site As System.ComponentModel.ISite
  
    Public Event DisposedAsStrip As EventHandler Implements IBindableComponent.Disposed
  
    Sub New(ByVal name As String)
      MyBase.New(name)
    End Sub
  
    Public ReadOnly Property DataBindings() As ControlBindingsCollection Implements System.Windows.Forms.IBindableComponent.DataBindings
      Get
        If _DataBindings Is Nothing Then
          _DataBindings = New ControlBindingsCollection(Me)
        End If
        Return _DataBindings
      End Get
    End Property
  
    Public Property BindingContext() As BindingContext Implements System.Windows.Forms.IBindableComponent.BindingContext
      Get
        If _BindingContext Is Nothing Then
          _BindingContext = New BindingContext()
        End If
        Return _BindingContext
      End Get
      Set(ByVal value As BindingContext)
        _BindingContext = value
      End Set
    End Property
  
    Public Overloads Sub Dispose()
      If _DataBindings IsNot Nothing Then
        _DataBindings.Clear()
        _DataBindings = Nothing
      End If
      _BindingContext = Nothing
  
      MyBase.Dispose()
  
      RaiseEvent DisposedAsStrip(Me, EventArgs.Empty)
    End Sub
  
    Property Site As System.ComponentModel.ISite Implements System.ComponentModel.IComponent.Site
      Get
        Return _Site
      End Get
      Set(ByVal value As System.ComponentModel.ISite)
        _Site = value
      End Set
    End Property
  
  End Class
  </code></pre>