Question

I've got a Control (mySubControl) which inherits from a UserControl (myAbstractControl) which is abstract. When I try to set dependency Properties inside mySubControl I always get errors on runtime, saying:

"System.Windows.Data Error: 40 : BindingExpression path error: 'myPropertyRegistrationName' property not found on ...."

I think somehow the DataContext of mySubControl gets messed up.

I tried to use the relative bindings, but it also doesn't fix it.

Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type myNS:myType}},
                     Path=myPropertyRegistrationName}"

Can anybody help me ?

Thx

Was it helpful?

Solution

It's always syntax, isn't it ?

Visibility="{Binding myPropertyRegistrationName, RelativeSource={RelativeSource FindAncestor, AncestorType=myNS:myType}}"

Thx anyway.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top