2017-04-18 07:52:04 +08:00
|
|
|
## Two-way data-binding to a property with a non-public setter is not supported
|
2017-04-06 04:52:19 +08:00
|
|
|
|
|
|
|
### Scope
|
|
|
|
Minor
|
|
|
|
|
|
|
|
### Version Introduced
|
|
|
|
4.5.1
|
|
|
|
|
|
|
|
### Source Analyzer Status
|
|
|
|
Planned
|
|
|
|
|
|
|
|
### Change Description
|
2017-04-21 02:19:05 +08:00
|
|
|
|
|
|
|
Attempting to data bind to a property without a public setter has never been a
|
|
|
|
supported scenario. Beginning in the .NET Framework 4.5.1, this scenario will
|
|
|
|
throw an <xref:System.InvalidOperationException?displayProperty=name>. Note that
|
|
|
|
this new exception will only be thrown for apps that specifically target the
|
|
|
|
.NET Framework 4.5.1. If an app targets the .NET Framework 4.5, the call will be
|
|
|
|
allowed. If the app does not target a particular .NET Framework version, the
|
|
|
|
binding will be treated as one-way.
|
2017-04-06 04:52:19 +08:00
|
|
|
|
|
|
|
- [x] Quirked
|
|
|
|
- [ ] Build-time break
|
|
|
|
|
|
|
|
### Recommended Action
|
2017-04-21 02:19:05 +08:00
|
|
|
|
|
|
|
The app should be updated to either use one-way binding, or expose the
|
|
|
|
property's setter publicly. Alternatively, targeting the .NET Framework 4.5 will
|
|
|
|
cause the app to exhibit the old behavior.
|
2017-04-06 04:52:19 +08:00
|
|
|
|
|
|
|
### Affected APIs
|
|
|
|
* `F:System.Windows.Data.BindingMode.TwoWay`
|
|
|
|
|
|
|
|
### Category
|
|
|
|
Windows Presentation Foundation (WPF)
|
|
|
|
|
|
|
|
[More information](http://connect.microsoft.com/VisualStudio/feedback/details/773682/wpf-property-with-private-setter-is-updated-by-a-twoway-binding)
|
|
|
|
|
|
|
|
<!--
|
|
|
|
### Notes
|
|
|
|
This is a good candidate for a non-code source analyzer since most cases of two-way binding will be defined in XAML
|
|
|
|
-->
|
|
|
|
|
2017-04-18 07:52:04 +08:00
|
|
|
<!-- breaking change id: 129 -->
|