
[英]how to access RichTextBox from one xaml file to another xaml file?
[英]How to load a XAML file in another XAML file
我希望能够将XAML文件(或属于另一个XAML文件的控件,例如网格)动态加载到当前页面的控件中。 例如并示意性地:
在Page1.xaml中:
<Grid Name=HelloGrid>
<TextBlock Text="Hello">
</Grid>
在Page2.xaml中:
<Grid>
//part where I load Page1.xaml or just HelloGrid
</Grid>
谢谢你的时间,凯文
您想执行composite
xaml而不加载它们。 您可以尝试创建一个包含给您的Page1.xaml一个用户控件a
在你定义的前缀xaml
文件
CustomControl.xaml
<Grid Name=HelloGrid>
<TextBlock Text="Hello">
</Grid>
并在您的Page1和Page2 xaml上
你可以做
的Page1.xaml
<a:CustomControl/>
和
Page2.xaml
<Grid>
<a:CustomControl/>
</Grid>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.