....
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?
Fixed:
<toolkit:DataForm x:Name="form"
HorizontalAlignment="Left" VerticalAlignment="Top"
DataContext="{StaticResource RecipeViewModel}"
ItemsSource="{Binding Recipes}" Width="500" Height="600" />
Had to add the DataContext line.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.