You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mastermind/Sources/MauiSpark/Vues/JetonVue.xaml.cs

31 lines
955 B

using Microsoft.Maui.Controls.Shapes;
namespace MauiSpark.Vues;
public partial class JetonVue : ContentView
{
public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
public Color Couleur
{
get => (Color)GetValue(CouleurProperty);
set => SetValue(CouleurProperty, Color.FromRgb(0, 255, 0));
}
public JetonVue()
{
InitializeComponent();
BindingContext = this;
}
private void QuandTailleChangee(object sender, EventArgs e)
{
double taille = Math.Min(Grid.Width, Grid.Height) / 2;
Cercle.WidthRequest = Cercle.HeightRequest = taille;
}
private static void QuandCouleurChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
{
((JetonVue)bindable).Cercle.Fill = (Color) nouvelleValeur;
}
}