Skip to content

Commit

Permalink
Fix TabView selection (#3988)
Browse files Browse the repository at this point in the history
- Previously, the TabViewListView's SelectedItem was set to the item container. Instead, this should be set to the list item type itself, as that's what is also the ItemsSource of the TabViewListView.
  • Loading branch information
MartinZikmund authored Mar 17, 2021
1 parent d20fcb8 commit cc0d193
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions dev/TabView/TabView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,20 +983,7 @@ void TabView::UpdateSelectedItem()
{
if (auto&& listView = m_listView.get())
{
auto tvi = SelectedItem().try_as<winrt::TabViewItem>();
if (!tvi)
{
tvi = ContainerFromItem(SelectedItem()).try_as<winrt::TabViewItem>();
}

if (tvi)
{
listView.SelectedItem(tvi);

// Setting ListView.SelectedItem will not work here in all cases.
// The reason why that doesn't work but this does is unknown.
tvi.IsSelected(true);
}
listView.SelectedItem(SelectedItem());
}
}

Expand Down

0 comments on commit cc0d193

Please sign in to comment.