Additional fields Add, Update and Delete work (too well)

SelectableListView works when programmatically setting selection
This commit is contained in:
Geoffroy BONNEVILLE
2020-05-11 10:53:14 +02:00
parent 71b6009a29
commit bb2b99ed66
20 changed files with 274 additions and 101 deletions

View File

@@ -13,6 +13,7 @@ namespace ModernKeePass.ViewModels
{
private readonly IRecentProxy _recent;
private ObservableCollection<RecentItemVm> _recentItems;
private int _selectedIndex;
public ObservableCollection<RecentItemVm> RecentItems
{
@@ -21,7 +22,13 @@ namespace ModernKeePass.ViewModels
}
public ICommand ClearAllCommand { get; }
public int SelectedIndex
{
get { return _selectedIndex; }
set { Set(() => SelectedIndex, ref _selectedIndex, value); }
}
public RecentVm(IRecentProxy recent)
{
_recent = recent;
@@ -34,6 +41,7 @@ namespace ModernKeePass.ViewModels
{
var recentItems = _recent.GetAll().Select(r => new RecentItemVm(r));
RecentItems = new ObservableCollection<RecentItemVm>(recentItems);
if (RecentItems.Any()) SelectedIndex = 0;
}
private void ClearAll()