xamarin/Xamarin.Forms

[Bug] Binding to Dictionary is broken

Offen

#8.377 geöffnet am 05.11.2019

 (6 Kommentare) (0 Reaktionen) (1 zugewiesene Person)C# (1.926 Forks)batch import
4.3.0a/binding ⛓e/5 :clock5:help wantedi/regressioninactivet/bug :bug:up-for-grabs

Repository-Metriken

Stars
 (5.644 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Description

When updating to Xamarin.Forms 4.3 bindings to Dictionaries no longer work. The binding is on a Label where i show a value from a dictionary. The Value is converted to string with a custom IValueConverter. Before the update on Xamarin.Forms 4.2 everything worked perfectly. I already tried alot but nothing worked.

That's the binding in Codebehind:

value.SetBinding(Label.TextProperty, new Binding(string.Format("InputRegisters[{0}]", parameterOrSubemnu.Parameter.ModbusRegisterItem.RegisterAddress),
source: CurrentDevice.DataStore));

The dictionary: InputRegisters = new ConcurrentDictionary<ushort,ushort>();

Steps to Reproduce

  1. Create Dictionary of short, double or int.
  2. bind to dict.

I already tried many different ways of discribing the Binding, but nothing worked. Also tested it with different types like int or double.

Expected Behavior

Binding to Dictionary is working.

Actual Behavior

I get: [0:] Binding: can not be converted to type 'System.Double'

Basic Information

  • Version with issue: Xamarin.Forms 4.3.0.947036
  • Last known good version: Xamarin.Forms 4.2...
  • IDE: Visual Studio 19 Windows
  • Platform Target Frameworks:
    • iOS: iOS SDK 13
    • Android: 9

Screenshots

grafik

Contributor Guide