There are a couple of classes
public class A { public static A A1 = new A(); public static A A2 = new A(); public static A A3 = new A(); ... } public class B { public string this[A a] { get { return a.ToString(); /*тут может быть что угодно*/ } } } You must specify in the binding of the element, with a DataContext instance of class B , to the property .[A:A1] , something like this:
<TextBlock Text="{Binding Path=.[MyEnum:A.A1]"> however, a binding error occurs
System.Windows.Data Error: 40: BindingExpression path error: '[]' property not found on 'object' '' B '(HashCode = 36232091)'. BindingExpression: Path =. [MyEnum: A.A1]; DataItem = 'B' (HashCode = 36232091); target element is 'TextBlock' (Name = ''); target property is 'Text' (type 'String')
but if we do
public class B { public string this[int a] { get { return a.ToString(); } } } and
<TextBlock Text="{Binding Path=.[666]"> then everything goes with a bang. How to make a binding to an enumerated property by the index of a static property?