I have a groupbox with child buttons. All the child buttons have their .Enabled databound to form-level booleans. I also databound the booleans to labels for the sake of troubleshooting. This is a minimal reproduction of a problem I'm having in a larger app.
Disabling the groupbox works fine.
Re-enabling the groupbox does not, as can be seen in the screen capture. Button3 ought to get re-enabled. It doesn't. Why?
Imports System.ComponentModel
Public Class Form1
Implements INotifyPropertyChanged
Private _canClone As Boolean = True
Private _canEdit As Boolean = True
Public Property CanClone As Boolean
Get
Return _canClone
End Get
Set(value As Boolean)
_canClone = value
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("CanClone"))
End Set
End Property
Public Property CanEdit As Boolean
Get
Return _canEdit
End Get
Set(value As Boolean)
_canEdit = value
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("CanEdit"))
End Set
End Property
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
GroupBox1.Enabled = Not GroupBox1.Enabled
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Button1.DataBindings.Add(New Binding("Enabled", Me, "CanClone" , True, DataSourceUpdateMode.OnPropertyChanged))
Button3.DataBindings.Add(New Binding("Enabled", Me, "CanEdit" , True, DataSourceUpdateMode.OnPropertyChanged))
Label1 .DataBindings.Add(New Binding("Text", Me, "CanClone" , True, DataSourceUpdateMode.OnPropertyChanged))
Label3 .DataBindings.Add(New Binding("Text", Me, "CanEdit" , True, DataSourceUpdateMode.OnPropertyChanged))
End Sub
End Class