Linking to this property is quite simple:
public Foo MyFoo {get; set;} public class Foo { public object this[object key] }
Because here in XAML you can do:
<Label Content="{Binding MyFoo["key"]}"/>
But what if I had a second indexed property?
I know that this is not possible directly in C #, but it is in VB.NET.
Default Public Property Item(key As Object) As Object 'equivalent to this[...]' Public Property Item2(key As Object) As Object 'a second indexed property!'
These are some of the bindings I tried:
<Label Content="{Binding MyFoo["key"]}"/> <Label Content="{Binding MyFoo.Item["key"]}"/> <Label Content="{Binding MyFoo.Item2["key"]}"/> [" key "]}" /> <Label Content="{Binding MyFoo["key"]}"/> <Label Content="{Binding MyFoo.Item["key"]}"/> <Label Content="{Binding MyFoo.Item2["key"]}"/> [" key "]}" /> <Label Content="{Binding MyFoo["key"]}"/> <Label Content="{Binding MyFoo.Item["key"]}"/> <Label Content="{Binding MyFoo.Item2["key"]}"/>
The first binding will still work, but the other two will not.
Is there a direct solution for this or do I need a workaround?
source share