I have a RadCheckedListBox bound to a list of objects. The RadCheckedListBox's CheckedMember value corresponds to the "IsChecked" property on each object.
Updating that property value on the objects does not update the view on the RadCheckedListBox until the RadCheckedListBox receives focus. Surely this not by design?
Windows 7 Ultimate SP1
.NET 4.5
UI for WinForms Q2 2016
2016.2.503.40
C# code example:
// This code is a simple WinForms project that has a RadCheckedListBox and a regular WinForms CheckBox.
// When the checkbox is checked/unchecked, the "IsChecked" property of the first item in the list (not the control) is toggled.
// Because of the data binding, the first item in the RadCheckedListBox control should be visually updated to reflect the updated state.
public class SimpleObject
{
public int Id { get; set; }
public string Name { get; set; }
public bool IsChecked { get; set; }
}
private IEnumerable<SimpleObject> CreateSimpleObjects()
{
List<SimpleObject> data = new List<SimpleObject>()
{
new SimpleObject() { Id = 1, Name = "Item1", IsChecked = false },
new SimpleObject() { Id = 2, Name = "Item2", IsChecked = true },
new SimpleObject() { Id = 3, Name = "Item3", IsChecked = true },
new SimpleObject() { Id = 4, Name = "Item4", IsChecked = false },
new SimpleObject() { Id = 5, Name = "Item5", IsChecked = false },
new SimpleObject() { Id = 6, Name = "Item6", IsChecked = true }
};
return data;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
var firstItem = this.radCheckedListBox1.Items[0].DataBoundItem as SimpleObject;
firstItem.IsChecked = !firstItem.IsChecked;
// // This makes it work as expected.
// var activeControl = this.ActiveControl;
// this.ActiveControl = this.radCheckedListBox1;
// this.ActiveControl = activeControl;
}