xamarin/Xamarin.Forms

[Bug] Binding to Dictionary is broken

Ouverte

#8 377 ouverte le 5 nov. 2019

 (6 commentaires) (0 réaction) (1 personne assignée)C# (1 926 forks)batch import
4.3.0a/binding ⛓e/5 :clock5:help wantedi/regressioninactivet/bug :bug:up-for-grabs

Métriques du dépôt

Stars
 (5 644 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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

Guide contributeur