AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.63k stars 2.22k forks source link

Binding to indexer with 2 parameters, triggers indexer with 1 parameter #12665

Open Varmod opened 1 year ago

Varmod commented 1 year ago

Describe the bug I want to bind to a indexer with 2 parameters from xaml. I was following this wpf question but it doesn't work for me in Avalonia.

<TextBlock Classes="Subtitle" Margin="5">
   <TextBlock.Text>
      <Binding Path="Translations[TYPE_ACTUATOR_PHYSICAL,PRESSURE]"/>
   </TextBlock.Text>
</TextBlock>

The xaml builds properly, but what happens is that that indexer for 1 parameter is triggered and the PRESSURE parameter is ignored.

public string this[string identifier]
{
   get
   {
       return GetString(identifier);
   }
}

public string this[string identifier, string parameter]
{
   get
   {
       return GetStringSubstituteIdentifier(identifier, substituionsIdentifier: parameter);
   }
}

Desktop (please complete the following information):

timunie commented 1 year ago

looks like the very first this is called and the rest is irgnored. If I have only one of the indexer, it works