Skip to content

Commit

Permalink
Fix code bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbritch committed Jan 24, 2025
1 parent d78e7a5 commit daac1c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/user-interface/controls/carouselview/populate-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,17 @@ carouselView.ItemTemplate = new DataTemplate(() =>
IconImageSource = "favorite.png",
BackgroundColor = Colors.LightGreen
};
favoriteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (CarouselView cv) => (cv.BindingContext as MonkeysViewModel).FavoriteCommand, source: carouselView));
favoriteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CarouselView cv) => cv.CurrentItem);
favoriteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (MonkeysViewModel vm) => vm.FavoriteCommand, source: carouselView.BindingContext);
favoriteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CarouselView cv) => cv.CurrentItem, source: carouselView);

SwipeItem deleteSwipeItem = new SwipeItem
{
Text = "Delete",
IconImageSource = "delete.png",
BackgroundColor = Colors.LightPink
};
deleteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (CarouselView cv) => (cv.BindingContext as MonkeysViewModel).DeleteCommand, source: carouselView));
deleteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CarouselView cv) => cv.CurrentItem);
deleteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (MonkeysViewModel vm) => vm.DeleteCommand, source: carouselView.BindingContext);
deleteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CarouselView cv) => cv.CurrentItem, source: carouselView);

swipeView.TopItems = new SwipeItems { favoriteSwipeItem };
swipeView.BottomItems = new SwipeItems { deleteSwipeItem };
Expand Down
8 changes: 4 additions & 4 deletions docs/user-interface/controls/collectionview/populate-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,17 @@ collectionView.ItemTemplate = new DataTemplate(() =>
IconImageSource = "favorite.png",
BackgroundColor = Colors.LightGreen
};
favoriteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (CollectionView cv) => (cv.BindingContext as MonkeysViewModel).FavoriteCommand, source: collectionView));
favoriteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CollectionView cv) => cv.SelectedItem);
favoriteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (MonkeysViewModel vm) => vm.FavoriteCommand, source: collectionView.BindingContext);
favoriteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CollectionView cv) => cv.SelectedItem, source: collectionView);

SwipeItem deleteSwipeItem = new SwipeItem
{
Text = "Delete",
IconImageSource = "delete.png",
BackgroundColor = Colors.LightPink
};
deleteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (CollectionView cv) => (cv.BindingContext as MonkeysViewModel).DeleteCommand, source: collectionView));
deleteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CollectionView cv) => cv.CurrentItem);
deleteSwipeItem.SetBinding(MenuItem.CommandProperty, Binding.Create(static (MonkeysViewModel vm) => vm.DeleteCommand, source: collectionView.BindingContext);
deleteSwipeItem.SetBinding(MenuItem.CommandParameterProperty, static (CollectionView cv) => cv.SelectedItem, source: collectionView);

swipeView.LeftItems = new SwipeItems { favoriteSwipeItem, deleteSwipeItem };
swipeView.Content = grid;
Expand Down

0 comments on commit daac1c1

Please sign in to comment.