如何在Mainpage.xaml中引用用户控件 [英] How To Refer User Control In a Mainpage.xaml
本文介绍了如何在Mainpage.xaml中引用用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
      我正在开发Windows 8手机应用程序。在此我添加了3个用户控件,我需要在mainpage.xaml中显示用户控件..
I am developing windows 8 phone app.In this i have added the 3 user controls i need to display the user control in a mainpage.xaml..
    任何人都可以帮我找到完整的解决方案
Could anyone help me to find the complete solution
推荐答案
非常简单。假设您的命名空间名为MyNamespace,您的控件名为MyControl。在您的XAML文件中首先添加名称空间:
Really simple. Let's say your namespace is named MyNamespace and your control is named MyControl. In your XAML file first add namespace:
xmlns:local="clr-namespace:MyNamespace"
稍后在文件中,您只需使用以下语法实例化控件:
And later in the file you simply instantiate the control with the following syntax:
<local:MyControl />
这篇关于如何在Mainpage.xaml中引用用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文