Binding INvite

Test_Binding
Tony Fages 2 years ago
parent 81ef0ace75
commit 9398caf21e

@ -58,9 +58,20 @@ namespace ParionsCuite.Modeles
Persistance.sauvegardeDonnees(Evenement);
}
internal void AddInvite(Inviter invite1)
internal List<Inviter> AddInvite(Inviter invite1)
{
Invites.Add(invite1);
return Invites;
}
public int LenListInvite(List<Inviter> list)
{
int len = 0;
foreach (Inviter inviter in list)
{
len++;
}
return len;
}
}
}

@ -15,7 +15,7 @@
</StackLayout>
<!--Grid prenom et nom + output -->
<Grid Grid.Column="2" Margin="30">
<Grid Grid.Column="2" Margin="30" x:Name="GrilleInvite">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
@ -23,8 +23,8 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Label Text="Prenom" Grid.Column="1" Grid.Row="0" BackgroundColor="LightGrey" FontSize="Large"/>
<Label Text="Nom" Grid.Column="0" Grid.Row="0" BackgroundColor="LightGrey" FontSize="Large"/>

@ -20,7 +20,42 @@ public partial class Inviter : ContentView
string nom = nomEditor.Text;
string prenom = prenomEditor.Text;
Modeles.Inviter invite1 = new Modeles.Inviter(nom, prenom);
BindingContext = invite1;
m.AddInvite(invite1);
List<Modeles.Inviter> invites = m.AddInvite(invite1);
int len = 1;
foreach (Modeles.Inviter inviter in invites)
{
RowDefinition row = new RowDefinition();
row.Height = new GridLength(45);
GrilleInvite.RowDefinitions.Add(row);
// AJout Prenom
Label prenomLabel = new Label();
prenomLabel.Text = inviter.Prenom;
Grid.SetRow(prenomLabel, len);
Grid.SetColumn(prenomLabel, 0);
GrilleInvite.Children.Add(prenomLabel);
// Ajout Nom
Label nomLabel = new Label();
nomLabel.Text = inviter.Nom;
Grid.SetRow(nomLabel, len);
Grid.SetColumn(nomLabel, 1);
GrilleInvite.Children.Add(nomLabel);
// Ajout Bouton
Button buttonMoins = new Button();
buttonMoins.Text = "-";
Grid.SetRow(buttonMoins, len);
Grid.SetColumn(buttonMoins , 2);
GrilleInvite.Children.Add(buttonMoins );
//GrilleInvite.HeightRequest = Height + 2;
len++;
}
}
}
Loading…
Cancel
Save