如何在 XAML 中绑定数据表单
....
xmlns:viewmodel="clr-namespace:MyRecipe.ViewModels">
<navigation:Page.Resources>
<viewmodel:RecipeViewModel x:Key="RecipeViewModel" />
</navigation:Page.Resources>
<toolkit:DataForm x:Name="form"
HorizontalAlignment="Left" VerticalAlignment="Top"
ItemsSource="{Binding Recipes}" Width="500" Height="600" />
在视图模型中:
public EntitySet<Recipe> Recipes
{
get { return _recipes; }
set
{
if (_recipes != value)
{
_recipes = value;
OnPropertyChanged("Recipes");
}
}
}
我想将数据表单绑定到食谱实体集。数据表单未显示任何字段或任何已绑定的指示。怎么了?
....
xmlns:viewmodel="clr-namespace:MyRecipe.ViewModels">
<navigation:Page.Resources>
<viewmodel:RecipeViewModel x:Key="RecipeViewModel" />
</navigation:Page.Resources>
<toolkit:DataForm x:Name="form"
HorizontalAlignment="Left" VerticalAlignment="Top"
ItemsSource="{Binding Recipes}" Width="500" Height="600" />
In the viewmodel:
public EntitySet<Recipe> Recipes
{
get { return _recipes; }
set
{
if (_recipes != value)
{
_recipes = value;
OnPropertyChanged("Recipes");
}
}
}
I want to bind the dataform to the Recipes entityset. The dataform is not showing any fields or any indication that it is bound. What's wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已修复:
必须添加 DataContext 行。
Fixed:
Had to add the DataContext line.