[英]How to bind dataform in 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");
}
}
}
我想將數據形式綁定到配方實體集。 數據表單未顯示任何字段或綁定的任何指示。 怎么了?
固定:
<toolkit:DataForm x:Name="form"
HorizontalAlignment="Left" VerticalAlignment="Top"
DataContext="{StaticResource RecipeViewModel}"
ItemsSource="{Binding Recipes}" Width="500" Height="600" />
必須添加DataContext行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.