diff --git a/SmartPanel.xaml.cpp b/SmartPanel.xaml.cpp index 8ee8d73756b895092a5b86802418a936b80cdfeb..2366becf81f94ccc52182b19e25fd1b3f4d6c07e 100644 --- a/SmartPanel.xaml.cpp +++ b/SmartPanel.xaml.cpp @@ -180,6 +180,20 @@ void SmartPanel::_accountList__SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e) { auto listbox = safe_cast<ListBox^>(sender); + // disable deselction from listbox + if (listbox->SelectedItem == nullptr) + { + if (e->RemovedItems->Size > 0) + { + Object^ itemToReselect = e->RemovedItems->GetAt(0); + for each (auto item in listbox->Items) { + if (item == itemToReselect) { + listbox->SelectedItem = itemToReselect; + continue; + } + } + } + } auto account = safe_cast<Account^>(listbox->SelectedItem); AccountsViewModel::instance->selectedAccount = account; updatePageContent();