xamarin/Xamarin.Forms

[Bug] Binding to Dictionary is broken

Aberta

#8.377 aberto em 5 de nov. de 2019

 (6 comentários) (0 reação) (1 responsável)C# (1.926 forks)batch import
4.3.0a/binding ⛓e/5 :clock5:help wantedi/regressioninactivet/bug :bug:up-for-grabs

Métricas do repositório

Stars
 (5.644 estrelas)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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

Guia do colaborador