Closed Alison-97 closed 1 year ago
These are all Windows Forms controls, I don't see how this belongs in this repo.
Note that you can reference Winforms in a supported way rather than adding its assemblies as references, and that is by checking a checkbox in the project properties:
Also note that BindingControlsToVM
is called twice, once from constructor, once when loaded. If you call it only once in constructor, it seems to work for me regardless of the order.
Also note that you are promising with INotifyPropertyChanged
but not delivering, you should be invoking PropertyChanged
whenever IsChecked
or DisableText
values are changed.
However, I think you have more serious problems. I think in Winforms the binding does not apply until a control is made visible. Workarounds seem to suggest either calling internal CreateControl(true)
on the controls, or making them visible in the designer and then hiding them in the code.
Why not make your app in WPF? It's so much better!
These problematic controls are indeed from WinForms, but the binding issue only occurs when these WinForms controls are hosted in WPF. The attached file is a WPF project that incorporates the WinForms controls.
Not true: create a new Winforms app, add a button to it and on button click, add new UserControl2() to the Controls. Same behaviour.
Thank you for pointing it out. The issue can indeed be reproduced even without using a WPF wrapper. Since the issue lies with only WinForms controls, I'll post it on the WinForms forum.
Description
The binding ability of the CheckBox control is affected by the sequence of ComboBox binding. If the ComboBox is binded first, the subsequent binding will not work.
https://github.com/dotnet/wpf/assets/97237245/df2788ca-42f5-4aff-8c74-1e1f194b5447
Reproduction Steps
Note that when the GroupBox (containing the Label) and CheckBox is in tabPage1 instead of tabPage2 , the ComboBox binding sequence won’t affect the functionality of the CheckBox
Expected behavior
The CheckBox should be working regardless of the sequence of the ComboBox binding
Actual behavior
The binding ability is dependent on the binding sequence, as well as the tabPage number
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
No response