I have an array parameter of type Parameter in the namespace Parameter.Model. I try to bind to a specific value. If I do the following it works without any problems:
...
xmlns:p="clr-namespace:Parameter.Model;assembly=Parameter"
...
<Button Content="{Binding Path=.[1].GWert, Source={x:Static p:Parameterliste.parameter},Mode=TwoWay}"/>
Now I want to define the index with my Enum parBez:
namespace Parameter.Model
{
public enum parBez : int
{
Val1,
Val2,
Val3,
}
}
I tried the suggestions for the converter parameter from that post
As example I tried the following two lines to display the Enum in a Button as a test:
<Button Content="{Binding Path=x:Static p:parBez.Val1,Mode=TwoWay}"/>
and
<Button Content="{Binding Path=.Val1, Source={x:Static p:parBez},Mode=TwoWay}"/>
but it did not work.
- The first option does compile but does not display any text in the button. There is no message displayed in the output as well.
The second option does not compile and shows the following compiler errors:
Invalid property path syntax
'p:parBez' member is not valid because it does not have a qualifying type name.
Cannot find the member "parBez" on the target type
Does anybody can give me a hint what I do wrong or which is the solution to use the Enum in XAML and use it as a index for my array?
I checked also this post but I think the ValueConverter is not a solution for me because the NotifyEvent is missed if the ValueConverter converts the Enum Value.
Hope that someone had this problem before and could advise me. Thanks in advance for every hint.