Hello,
Welcome to Microsoft Q&A!
As far as I'm concerned, the RelativeSource property in WinUI3 is not support the FindAncestor mode
.
If you want to bind to a property of a parent element in the visual tree, you could try to set the ElementName
property of the binding to the name of the ancestor element to bind to instead of using a RelativeSource
.
And you could try to create a Custom attached properties that sets the DataContext
of the target element to a parent element of a specific type.
Thank you.
Jeanine
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.