Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin.Forms binding with indexers crashes application

$
0
0

When using an object with two indexers, the binding can't resolve it and the application crashes.

For instance, if the following binding is set

<Label Text="{Binding [asdf]}" />

And the BindingContext is an instance of the following class

public class MyClass
{
    public string this[int index]
    {
        get
        {
            return "Accessing through integer indexer";
        }
    }

    public string this[string index]
    {
        get
        {
            return "Accessing through string indexer";
        }
    }
}

an unhandled exception is thrown.

if the integer indexer is commented the binding works fine.

Regards,
Alvaro.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>