digiCamControl
digiCamControl copied to clipboard
Camera property changes not reflected in Windows Forms controls
CameraControl.Devices.Example.zip
Windows Forms controls bound to properties that descend from PropertyValue<T> are not updated when the Value changes.
I've attached a couple of changes to the CameraControl.Devices.Example project that demonstrates this.
Added a textbox control and bound it to the ISO value of the selected camera in the RefreshDisplay method:
textBox2.DataBindings.Clear();
if (DeviceManager.SelectedCameraDevice.IsoNumber != null)
textBox2.DataBindings.Add("Text", DeviceManager.SelectedCameraDevice.IsoNumber, "Value", true);
Added a button whose handler does the following:
DeviceManager.SelectedCameraDevice.IsoNumber.Value = "1600";
The textbox value should update when the button is clicked but it doesn't. Restarting the example app shows the correct value.
I am not entirely sure why, but the problem appears to be these two lines in PropertyValue.cs:
public delegate void ValueChangedEventHandler(object sender, string key, T val);
public event ValueChangedEventHandler ValueChanged;
When i did a global rename of ValueChanged to PropValueChanged, everything worked as expected.