project hierarchy
你好。我有主XAML UWP视图(MainTabbar.xaml)和选项卡内容视图(MethodTabView.xaml)。MethodTabView.xaml位于另一个文件夹中。我需要将MethodTabView.xaml嵌入MainTabbar.xaml中。如果两个文件在同一个文件夹中,一切都可以嵌入,但如果文件位于不同的文件夹中,它就不工作了。请帮助
project hierarchy
你好。我有主XAML UWP视图(MainTabbar.xaml)和选项卡内容视图(MethodTabView.xaml)。MethodTabView.xaml位于另一个文件夹中。我需要将MethodTabView.xaml嵌入MainTabbar.xaml中。如果两个文件在同一个文件夹中,一切都可以嵌入,但如果文件位于不同的文件夹中,它就不工作了。请帮助
1条答案
按热度按时间hyrbngr71#
If I understand you correctly, you want to use the xaml control that you've created in another folder, right?
You will need to add references to the Page. I think you might change a little bit for your code.
I've made a simple demo and you could refer to it. I created a new Folder called
MethodFolder
, then I created a new UserControl calledTestUserControl
. After that, I added the reference to the page where I want to use the user control. Like:So here is the code that I'm using:
And this is the screenshot of my project: