FIX : Emprunts Prets Button Fonctionnel

commands-19-09
Lou BRODA 1 year ago
parent 81ace28547
commit 346256b1fc

@ -27,6 +27,8 @@
<RowDefinition Height="40"/>
<RowDefinition Height="10"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource HeaderGray}, Dark={StaticResource Gray900}}"
Grid.Row="0">
@ -41,12 +43,41 @@
Style="{StaticResource HeaderCollectionViewText}"
Grid.Column="1"/>
</Grid>
<Grid HorizontalOptions="Center"
Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<HorizontalStackLayout Spacing="10"
Grid.Column="0">
<Image Source="plus.png"/>
<Label Text="Add new contact"/>
</HorizontalStackLayout>
<!--<VerticalStackLayout IsVisible=""
Grid.Column="2">
<Grid FlowDirection="LeftToRight">
<Label Text="Prénom :" />
<Entry Placeholder="Saisissez le prénom"/>
<Label Text="Nom :"/>
<Entry Placeholder="Saisissez le nom"/>
<Button Text="Enregistrer"
Command="{Binding ContactsVM.Navigator.AddContactCommand}"/>
</Grid>
</VerticalStackLayout>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ContactsVM.}"/>
</Grid.GestureRecognizers>-->
</Grid>
<CollectionView ItemsSource="{Binding ContactsVM.Manager.AllContacts}"
SelectedItem="{Binding ContactsVM.Manager.SelectedContact}"
SelectionChangedCommand="{Binding ContactsVM.Manager.LendBookCommand}"
SelectionChangedCommandParameter="{Binding ContactsVM.Manager.SelectedContact}"
SelectionMode="Single"
Grid.Row="2">
Grid.Row="4">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModel:ContactVM">
<VerticalStackLayout>

@ -30,38 +30,80 @@ namespace LivreLand.ViewModel
public Color PretButtonBackgroundColor
{
get => pretButtonBackgroundColor;
set => pretButtonBackgroundColor = value;
get { return pretButtonBackgroundColor; }
set
{
if (pretButtonBackgroundColor != value)
{
pretButtonBackgroundColor = value;
OnPropertyChanged(nameof(PretButtonBackgroundColor));
}
}
}
public bool PretButtonIsEnabled
{
get => pretButtonIsEnabled;
set => pretButtonIsEnabled = value;
get { return pretButtonIsEnabled; }
set
{
if (pretButtonIsEnabled != value)
{
pretButtonIsEnabled = value;
OnPropertyChanged(nameof(PretButtonIsEnabled));
}
}
}
public Color EmpruntButtonBackgroundColor
{
get => empruntButtonBackgroundColor;
set => empruntButtonBackgroundColor = value;
get { return empruntButtonBackgroundColor; }
set
{
if (empruntButtonBackgroundColor != value)
{
empruntButtonBackgroundColor = value;
OnPropertyChanged(nameof(EmpruntButtonBackgroundColor));
}
}
}
public bool EmpruntButtonIsEnabled
{
get => empruntButtonIsEnabled;
set => empruntButtonIsEnabled = value;
get { return empruntButtonIsEnabled; }
set
{
if (empruntButtonIsEnabled != value)
{
empruntButtonIsEnabled = value;
OnPropertyChanged(nameof(EmpruntButtonIsEnabled));
}
}
}
public bool EmpruntCollectionIsVisible
{
get => empruntCollectionIsVisible;
set => empruntCollectionIsVisible = value;
get { return empruntCollectionIsVisible; }
set
{
if (empruntCollectionIsVisible != value)
{
empruntCollectionIsVisible = value;
OnPropertyChanged(nameof(EmpruntCollectionIsVisible));
}
}
}
public bool PretCollectionIsVisible
{
get => pretCollectionIsVisible;
set => pretCollectionIsVisible = value;
get { return pretCollectionIsVisible; }
set
{
if (pretCollectionIsVisible != value)
{
pretCollectionIsVisible = value;
OnPropertyChanged(nameof(PretCollectionIsVisible));
}
}
}
public ICommand PretsButtonCommand { get; private set; }
@ -88,40 +130,40 @@ namespace LivreLand.ViewModel
{
if (App.Current.PlatformAppTheme == AppTheme.Light)
{
pretButtonBackgroundColor = Colors.Transparent;
pretButtonIsEnabled = false;
empruntButtonBackgroundColor = Colors.White;
empruntButtonIsEnabled = true;
PretButtonBackgroundColor = Colors.Transparent;
PretButtonIsEnabled = false;
EmpruntButtonBackgroundColor = Colors.White;
EmpruntButtonIsEnabled = true;
}
else
{
pretButtonBackgroundColor = Colors.Transparent;
pretButtonIsEnabled = false;
empruntButtonBackgroundColor = Colors.Black;
empruntButtonIsEnabled = true;
PretButtonBackgroundColor = Colors.Transparent;
PretButtonIsEnabled = false;
EmpruntButtonBackgroundColor = Colors.Black;
EmpruntButtonIsEnabled = true;
}
pretCollectionIsVisible = false;
empruntCollectionIsVisible = true;
PretCollectionIsVisible = false;
EmpruntCollectionIsVisible = true;
}
public void EmpruntsButtonClicked()
{
if (App.Current.PlatformAppTheme == AppTheme.Light)
{
pretButtonBackgroundColor = Colors.White;
pretButtonIsEnabled = true;
empruntButtonBackgroundColor = Colors.Transparent;
empruntButtonIsEnabled = false;
PretButtonBackgroundColor = Colors.White;
PretButtonIsEnabled = true;
EmpruntButtonBackgroundColor = Colors.Transparent;
EmpruntButtonIsEnabled = false;
}
else
{
pretButtonBackgroundColor = Colors.Black;
pretButtonIsEnabled = true;
empruntButtonBackgroundColor = Colors.Transparent;
empruntButtonIsEnabled = false;
PretButtonBackgroundColor = Colors.Black;
PretButtonIsEnabled = true;
EmpruntButtonBackgroundColor = Colors.Transparent;
EmpruntButtonIsEnabled = false;
}
pretCollectionIsVisible = true;
empruntCollectionIsVisible = false;
PretCollectionIsVisible = true;
EmpruntCollectionIsVisible = false;
}
#endregion

Loading…
Cancel
Save