Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.29 KB

wpf-databinding-should-use-key-not-indexer.md

File metadata and controls

40 lines (31 loc) · 1.29 KB

Data Binding improvement for KeyedCollection

Scope

Major

Version Introduced

4.8

Source Analyzer Status

NotPlanned

Change Description

Fixed Binding's incorrect use of IList indexer when the source object declares a custom indexer with the same signature (e.g. KeyedCollection<int,TItem>).

  • Quirked
  • Build-time break

Recommended Action

In order for the application to benefit from this change, it must run on the .NET Framework 4.7.2 or later, and it must opt in to the change by adding the following AppContext switch to the <runtime> section of the app config file and setting it to false:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
      </startup>
      <runtime>
        <!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true|false;key2=true|false  -->
        <AppContextSwitchOverrides value="Switch.System.Windows.Data.Binding.IListIndexerHidesCustomIndexer=false" />
      </runtime>
    </configuration>

Category

WPF