Skip to content

Commit

Permalink
fixed right bottom border (#6693)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojhad authored Feb 14, 2022
1 parent 4f16e0a commit 4bab324
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
24 changes: 15 additions & 9 deletions dev/TabView/TabViewListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@ TabViewListView::TabViewListView()

void TabViewListView::OnSelectedIndexPropertyChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args)
{
winrt::VisualStateManager::GoToState(
*this,
(SelectedIndex() == 0) ? L"LeftBottomBorderLineShort" : L"LeftBottomBorderLineNormal",
false /*useTransitions*/);

winrt::VisualStateManager::GoToState(
*this,
(SelectedIndex() == (int)(Items().Size() - 1)) ? L"RightBottomBorderLineShort" : L"RightBottomBorderLineNormal",
false /*useTransitions*/);
UpdateBottomBorderVisualState();
}

// IItemsControlOverrides
Expand Down Expand Up @@ -60,6 +52,7 @@ void TabViewListView::OnItemsChanged(winrt::IInspectable const& item)
const auto internalTabView = winrt::get_self<TabView>(tabView);
internalTabView->OnItemsChanged(item);
}
UpdateBottomBorderVisualState();
}

void TabViewListView::PrepareContainerForItemOverride(const winrt::DependencyObject& element, const winrt::IInspectable& item)
Expand Down Expand Up @@ -92,3 +85,16 @@ void TabViewListView::OnContainerContentChanging(const winrt::IInspectable& send
internalTabView->UpdateTabContent();
}
}

void TabViewListView::UpdateBottomBorderVisualState()
{
winrt::VisualStateManager::GoToState(
*this,
(SelectedIndex() == 0) ? L"LeftBottomBorderLineShort" : L"LeftBottomBorderLineNormal",
false /*useTransitions*/);

winrt::VisualStateManager::GoToState(
*this,
(SelectedIndex() == (int)(Items().Size() - 1)) ? L"RightBottomBorderLineShort" : L"RightBottomBorderLineNormal",
false /*useTransitions*/);
}
1 change: 1 addition & 0 deletions dev/TabView/TabViewListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ class TabViewListView :
private:
void OnContainerContentChanging(const winrt::IInspectable& sender, const winrt::ContainerContentChangingEventArgs& args);
void OnSelectedIndexPropertyChanged(const winrt::DependencyObject& sender, const winrt::DependencyProperty& args);
void UpdateBottomBorderVisualState();
};

0 comments on commit 4bab324

Please sign in to comment.