-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area-VSDesignerWindows Forms out-of-proc designer related issuesWindows Forms out-of-proc designer related issues
Milestone
Description
Environment
17.6.5
.NET version
All up to 7.0
Did this work in a previous version of Visual Studio and/or previous .NET release?
I think - no, 4.8 also checked.
Issue description
Designer always add bindings with formattingEnabled == true you can't change this behavior even if "Format type" == "No formatting":

Screen above will result in:
this.checkBox1.DataBindings.Add(new System.Windows.Forms.Binding("CheckState", this.paramsBindingSource, "checkState", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));More of it, if you manually change it to false in Form1.Designer.cs - any change in designer will revert it to true.
This is a critical bug for DataBindings. For example you can't bind to CheckState property of CheckBox with formattingEnabled == true - you will get error:

Maybe this is other bug? 🤔
So for now we need to do such a bindings manually outside of *.Designer.cs... 😭
Steps to reproduce
Build, run - try to click checkbox several times - you will see an error. If you change code in Form1.Designer.cs to:
this.checkBox1.DataBindings.Add(new System.Windows.Forms.Binding("CheckState", this.paramsBindingSource, "checkState", false, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));all will be ok.
DataBindingsFormatBug.zip
Metadata
Metadata
Assignees
Labels
area-VSDesignerWindows Forms out-of-proc designer related issuesWindows Forms out-of-proc designer related issues