DataBindings: can't set formattingEnabled to false in designer
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
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:
```cs
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:
```cs
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](https://github.com/dotnet/winforms/files/12144624/DataBindingsFormatBug.zip)
Contributor guide
Assessment
This issue has not been assessed yet.