【发布时间】:2014-04-09 05:37:28
【问题描述】:
我正在尝试创建一个简单的 Windows 应用商店应用程序。 我想在许多页面中重用一些“代码”。
例如,我需要在多个页面中重复使用这样的东西..
<StackPanel>
<TextBlock Text="Name"/>
<TextBox x:Name="edtNome"/>
也许最好的方法是使用“UserControl”...但我不知道怎么做!
我已经创建了我的 MyUC.xaml
<UserControl
x:Class="Crud.View.MyUC"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Crud.View"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid>
<StackPanel>
<TextBlock Text="Name"/>
<TextBox x:Name="edtName"/>
</StackPanel>
但是现在呢? 我想把它放在我的 Page.xaml(和许多其他)中,并从 page.xaml 代码后面访问“edtName”.....
我要做什么?
【问题讨论】:
标签: c# windows-store-apps winrt-xaml windows-store