How can I bind the Content of a Label to ViewModel.Config.UnitList[1].Dim
?
Config is a static property of the DataContext ViewModel, ListUnit is a List and Dim is a string.
I tried all kinds of things, like:
LBUnit="{Binding Source=DataContext.Config, Path=UnitList[1].Dim}"
LBUnit="{Binding Source=ViewModel.Config, Path=UnitList[1].Dim}"
LBUnit="{Binding Path=ViewModel.Confg.UnitList[1].Dim}"
And using this one from AIC (the last block)
[ContentProperty("Parameters")]
public class PathConstructor : MarkupExtension
{
public string Path { get; set; }
public IList Parameters { get; set; }
public PathConstructor()
{
Parameters = new List<object>();
}
public PathConstructor(string b, object p0)
{
Path = b;
Parameters = new[] { p0 };
}
public override object ProvideValue(IServiceProvider serviceProvider)
{
return new PropertyPath($"(ViewModel.Config.UnitList[{Index}].Dim)")
}
}
(property path adapted)