Continuation de la vue jeton
continuous-integration/drone/push Build is failing Details

master
Céleste BARBOSA 11 months ago
parent f05a0f997d
commit 643a15c879

@ -59,7 +59,7 @@
BindableLayout.ItemsSource="{Binding [0]}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Label Text="{Binding Path=Couleur, Converter={StaticResource conv:CouleurVersCouleurMAUI}}"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>

@ -24,7 +24,7 @@ internal class Tour
(IEnumerable<Jeton>, IEnumerable<Indicateur>)[] plateau = new (IEnumerable<Jeton>, IEnumerable<Indicateur>)[e.Grille.Count()];
for (int i = 0; i < e.Grille.Count(); ++i)
{
plateau[i] = (e.Grille.ElementAt(i).Where(x => x.HasValue).Select(x => x!.Value), e.Indicateurs.ElementAt(i));
plateau[i] = ([new Jeton(Couleur.ROUGE), new Jeton(Couleur.VERT), new Jeton(Couleur.BLEU), new Jeton(Couleur.JAUNE)], e.Indicateurs.ElementAt(i));
}
Plateau = plateau;
}

@ -43,4 +43,8 @@
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource BordureClair}, Dark={StaticResource BordureSombre}}"/>
</Style>
<Style TargetType="Ellipse">
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource BordureClair}, Dark={StaticResource BordureSombre}}"/>
</Style>
</ResourceDictionary>

@ -1,13 +1,15 @@
using Microsoft.Maui.Controls.Shapes;
namespace MauiSpark.Vues;
public partial class JetonVue : ContentView
{
public static readonly BindableProperty CouleurPropriete = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChange);
public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
public Color? Couleur
public Color Couleur
{
get => (Color?)GetValue(CouleurPropriete);
set => SetValue(CouleurPropriete, value);
get => (Color)GetValue(CouleurProperty);
set => SetValue(CouleurProperty, Color.FromRgb(0, 255, 0));
}
public JetonVue()
@ -22,26 +24,8 @@ public partial class JetonVue : ContentView
Cercle.WidthRequest = Cercle.HeightRequest = taille;
}
private static void QuandCouleurChange(BindableObject bindable, object oldValue, object newValue)
{
var view = bindable as JetonVue;
if (view != null)
{
view.UpdateCouleur();
}
}
private void UpdateCouleur()
{
// Gérer la couleur null
if (Couleur == null)
{
// Définir une couleur par défaut si null
BackgroundColor = Colors.Transparent; // Ou toute autre couleur par défaut
}
else
{
BackgroundColor = Couleur;
}
private static void QuandCouleurChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
{
((JetonVue)bindable).Cercle.Fill = (Color) nouvelleValeur;
}
}
Loading…
Cancel
Save