© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
Will Pittenger

❔ Can't get root XAML element of UserControl for binding

I have a user control that declares a property that I need to bind properties of its children to. I was trying
"{Binding Property, ElementName=window}"
"{Binding Property, ElementName=window}"
for my binding expression. But that seems to fail. It seems user controls don't have a window element. I tried
{Binding Property, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=20}}
{Binding Property, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=20}}
as well, but that doesn't work either. I don't know why. Can someone help? Technically,
UserControl
UserControl
isn't my immediate base class. So I tried the intermediate base class as well, but that didn't work. I also tried the derived class to no avail.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

[WPF]How to binding in the UserControl.xaml at the same time load UserControl.xaml UI?
C#CC# / help
2y ago
XAML Binding
C#CC# / help
11mo ago
❔ Binding Xaml
C#CC# / help
3y ago
❔ xamarin xaml binding
C#CC# / help
4y ago