private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { Recipe selected = (Recipe)dataGrid.SelectedItem; var recipe = client.GetRecipe(selected.IdRecipe); NavigationService.Navigate(new RecipePage(RecipeConverter.ConvertRecipe(recipe))); }
public MainPage() { InitializeComponent(); client = new ServiceClient(); RecipeSimplifiedDto[] tempList = client.GetRecipeList(); List <Recipe> recipeList = RecipeConverter.ConvertRecipeList(tempList); FrameworkElementFactory factory1 = new FrameworkElementFactory(typeof(Image)); Binding b1 = new Binding("Picture") { Mode = BindingMode.TwoWay }; factory1.SetValue(Image.SourceProperty, b1); factory1.SetValue(Image.HeightProperty, 50.0); DataTemplate cellTemplate1 = new DataTemplate() { VisualTree = factory1 }; pictureColumn.CellTemplate = cellTemplate1; dataGrid.ItemsSource = recipeList; }