Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabView TabGeometry Animation Loop & Under Tab Line Fix #8430

Merged
merged 3 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/TabView/TabView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ void TabView::UpdateTabWidths(bool shouldUpdateWidths, bool fillAllAvailableSpac
}
else
{
// Case: TabWidthMode "Compact" or "FitToContent"
// Case: TabWidthMode "Compact" or "SizeToContent"
tabColumn.MaxWidth(availableWidth);
tabColumn.Width(winrt::GridLengthHelper::FromValueAndType(1.0, winrt::GridUnitType::Auto));
if (auto&& listview = m_listView.get())
Expand Down
22 changes: 12 additions & 10 deletions dev/TabView/TabView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@
</VisualStateManager.VisualStateGroups>

<Border x:Name="BottomBorderLine" BorderBrush="{ThemeResource TabViewBorderBrush}" BorderThickness="1" Height="1" Grid.ColumnSpan="3" VerticalAlignment="Bottom"/>

<Path x:Name="LeftRadiusRenderArc"
x:Load="False"
Fill="{ThemeResource TabViewBorderBrush}"
Expand All @@ -755,15 +755,17 @@
Height="4"
Width="4"
Data="M0 0C0 1.19469 0.523755 2.26706 1.35418 3H4C2.34315 3 1 1.65685 1 0H0Z"/>

<Path x:Name="SelectedBackgroundPath"
x:Load="False"
Grid.ColumnSpan="3"
Fill="{ThemeResource TabViewItemHeaderBackgroundSelected}"
VerticalAlignment="Bottom"
Margin="-4,0,-4,0"
Visibility="Collapsed"
Data="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TabViewTemplateSettings.TabGeometry}" />

<Canvas>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment stating why this is here.

<Path x:Name="SelectedBackgroundPath"
x:Load="False"
Grid.ColumnSpan="3"
Fill="{ThemeResource TabViewItemHeaderBackgroundSelected}"
VerticalAlignment="Bottom"
Margin="-4,0,-4,0"
Visibility="Collapsed"
Data="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TabViewTemplateSettings.TabGeometry}" />
</Canvas>

<Border x:Name="TabSeparator"
HorizontalAlignment="Right"
Expand Down
9 changes: 3 additions & 6 deletions dev/TabView/TabViewItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ void TabViewItem::OnApplyTemplate()
void TabViewItem::UpdateTabGeometry()
{
auto const templateSettings = winrt::get_self<TabViewItemTemplateSettings>(TabViewTemplateSettings());
auto const scaleFactor = SharedHelpers::Is19H1OrHigher() ?
static_cast<float>(XamlRoot().RasterizationScale()) :
static_cast<float>(winrt::DisplayInformation::GetForCurrentView().RawPixelsPerViewPixel());

auto const height = ActualHeight();
auto const popupRadius = unbox_value<winrt::CornerRadius>(ResourceAccessor::ResourceLookup(*this, box_value(c_overlayCornerRadiusKey)));
Expand All @@ -141,11 +138,11 @@ void TabViewItem::UpdateTabGeometry()

WCHAR strOut[1024];
StringCchPrintf(strOut, ARRAYSIZE(strOut), data,
height - 1.0,
height,
leftCorner, leftCorner, leftCorner, leftCorner, leftCorner,
ActualWidth() - (leftCorner + rightCorner + 1.0f / scaleFactor),
ActualWidth() - (leftCorner + rightCorner),
rightCorner, rightCorner, rightCorner, rightCorner,
height - (5.0 + rightCorner));
height - (4.0f + rightCorner));

const auto geometry = winrt::XamlReader::Load(strOut).try_as<winrt::Geometry>();

Expand Down