diff --git a/source/Trek-12/Trek-12/Views/PageBoard.xaml b/source/Trek-12/Trek-12/Views/PageBoard.xaml index 6527854..587ac7a 100644 --- a/source/Trek-12/Trek-12/Views/PageBoard.xaml +++ b/source/Trek-12/Trek-12/Views/PageBoard.xaml @@ -2,58 +2,77 @@ - - - + + + + + - - + + + + + Padding="0"> + + + + + + + + - - - - + + + + + + - + BackgroundColor="Transparent" + SelectionChanged="OnOperationCellSelected" + Margin="50"> + - - - + + + - - + \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Views/PageBoard.xaml.cs b/source/Trek-12/Trek-12/Views/PageBoard.xaml.cs index 8260b4b..1f66020 100644 --- a/source/Trek-12/Trek-12/Views/PageBoard.xaml.cs +++ b/source/Trek-12/Trek-12/Views/PageBoard.xaml.cs @@ -1,4 +1,8 @@ +using System.Diagnostics; + namespace Trek_12.Views; + +using Models.Game; using Stub; public partial class PageBoard : ContentPage @@ -10,4 +14,19 @@ public partial class PageBoard : ContentPage InitializeComponent(); BindingContext = MyStub; } + + private void OnOperationCellSelected(object sender, SelectionChangedEventArgs e) + { + Debug.WriteLine("OnOperationCellSelected"); // Debug + if (e.CurrentSelection.Count > 0) // Si un élément est sélectionné + { + var selectedCell = (OperationCell)e.CurrentSelection[0]; + if (selectedCell != null && !selectedCell.IsChecked) + { + selectedCell.Check(); + Debug.WriteLine("OperationCell at ({0}, {1}) is checked", selectedCell.X, selectedCell.Y); // Debug + } + ((CollectionView)sender).SelectedItem = null; // Déselectionne l'élément pour la CollectionView + } + } } \ No newline at end of file