1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 15:06:06 +00:00
This commit is contained in:
Yan Maniez 2018-09-20 13:44:01 +02:00
parent 8715e97c12
commit ba64d02434
2 changed files with 24 additions and 2 deletions

View file

@ -38,7 +38,7 @@ namespace AideDeJeu.ViewModels
set
{
SetProperty(ref _BookmarkCollectionIndex, value);
LoadBookmarkCollection(BookmarkCollectionNames[BookmarkCollectionIndex]);
//LoadBookmarkCollection(BookmarkCollectionNames[BookmarkCollectionIndex]);
}
}
private ObservableCollection<Item> _BookmarkCollection = new ObservableCollection<Item>();
@ -54,6 +54,23 @@ namespace AideDeJeu.ViewModels
}
}
private ICommand _SelectedIndexChangedCommand = null;
public ICommand SelectedIndexChangedCommand
{
get
{
return _SelectedIndexChangedCommand ?? (_SelectedIndexChangedCommand = new Command(async() => await ExecuteSelectedIndexChangedCommand()));
}
}
private async Task ExecuteSelectedIndexChangedCommand()
{
if (BookmarkCollectionIndex >= 0 && BookmarkCollectionIndex < BookmarkCollectionNames.Count)
{
//BookmarkCollectionIndex = index;
await LoadBookmarkCollection(BookmarkCollectionNames[BookmarkCollectionIndex]);
}
}
private ICommand _GotoItemCommand = null;
public ICommand GotoItemCommand

View file

@ -10,6 +10,7 @@
<ResourceDictionary>
<tools:IntToBooleanConverter x:Key="IntToBooleanConverter" NonZeroValue="False" NullOrZeroValue="True" />
<tools:HeaderLevelToStyleConverter x:Key="HeaderLevelToStyleConverter" />
<tools:EventToCommandBehavior x:Key="EventToCommandBehavior" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.ToolbarItems>
@ -25,7 +26,11 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Picker Grid.Column="0" Grid.Row="0" Style="{StaticResource heading1}" HorizontalOptions="Fill" ItemsSource="{Binding BookmarkCollectionNames, Mode=OneWay}" ItemDisplayBinding="{Binding Mode=OneWay}" SelectedIndex="{Binding BookmarkCollectionIndex, Mode=TwoWay}" />
<Picker x:Name="BookmarkCollectionPicker" Grid.Column="0" Grid.Row="0" Style="{StaticResource heading1}" HorizontalOptions="Fill" ItemsSource="{Binding BookmarkCollectionNames, Mode=OneWay}" ItemDisplayBinding="{Binding Mode=OneWay}" SelectedIndex="{Binding BookmarkCollectionIndex, Mode=TwoWay}">
<Picker.Behaviors>
<tools:EventToCommandBehavior EventName="SelectedIndexChanged" Command="{Binding BindingContext.SelectedIndexChangedCommand, Source={x:Reference This}}" />
</Picker.Behaviors>
</Picker>
<Label Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="15,0,15,0" Style="{StaticResource heading3}" Text="Cette liste est vide, ajoutez des éléments à partir de la bibliothèque !" IsVisible="{Binding BookmarkCollection.Count, Converter={StaticResource IntToBooleanConverter}}" />