I have a class that contains a readonly DependencyProperty. From this class, I want to bind to the readonly DependencyProperty to another readonly DepenendencyProperty of another class (create binding from code).
Is there a possibility to do this? SetBinding() seems not to have a overload that takes a DependencyPropertyKey as a parameter? Neither seems the BindingOperations-class to provide such functionality.
The question can also be formulated: Can I create a binding for a readonly DependencyProperty if I have the DependencyPropertyKey?
This isn't possible because the FrameworkElement.SetBinding method only accepts a DependencyProperty as its first parameter. It would have been great if it would also accept a DependencyPropertyKey instead. Because the key isn't visible outside the class, it would still be read-only outside the class, but from within the class you could use it for a binding. Unfortunately, this isn't possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With