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

fix: TabbarItem with Neumorphic Style crash on Windows #1116

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Changes from all 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
96 changes: 21 additions & 75 deletions Uno.Gallery/Uno.Gallery.Shared/Views/Styles/NeumorphicStyles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@
</Viewbox>

<!-- Icon/Content spacing -->
<Border Visibility="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToCollapsed}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
<Border Visibility="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
<Border Width="8"
Visibility="{Binding Path=(ut:ControlExtensions.Icon), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NullToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}" />
</Border>
Expand Down Expand Up @@ -2111,7 +2111,7 @@
Data="{StaticResource MaterialCheckGlyphPathData}"
Fill="{ThemeResource OnPrimaryBrush}"
Stretch="Uniform"
Visibility="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource EmptyOrNullToVisible}, FallbackValue=Collapsed}" />
Visibility="{Binding Icon, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource EmptyOrNullToVisibleConverter}, FallbackValue=Collapsed}" />
</Grid>

<!-- C1: Content -->
Expand Down Expand Up @@ -2393,42 +2393,15 @@
</Border>

<!-- BADGE -->
<!-- This part can be replaced when InfoBadge will be available in WinUI3 -->
<!-- See this commit for the implementation: c935919b2c390014dd8509cc50e16b1549511ffa -->
<!-- (Related Branch: dev/agzi/I274-InfoBadgeImplementationForTBI) -->

<Grid Visibility="{TemplateBinding BadgeVisibility}">
<!-- Small Badge -->
<Ellipse Width="{ThemeResource NavigationTabBarItemSmallBadgeWidth}"
Height="{ThemeResource NavigationTabBarItemSmallBadgeHeight}"
Margin="{ThemeResource NavigationTabBarItemSmallBadgeMargin}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Fill="{ThemeResource NavigationTabBarItemErrorBrush}"
Visibility="{Binding BadgeValue, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToVisible}}" />


<!-- Large Badge -->
<Border Height="{ThemeResource NavigationTabBarItemLargeBadgeHeight}"
MinWidth="{ThemeResource NavigationTabBarItemLargeBadgeMinWidth}"
Margin="{ThemeResource NavigationTabBarItemLargeBadgeMargin}"
Padding="{ThemeResource NavigationTabBarItemLargeBadgePadding}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{ThemeResource NavigationTabBarItemErrorBrush}"
CornerRadius="{ThemeResource NavigationTabBarItemLargeBadgeCornerRadius}"
Visibility="{Binding BadgeValue, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToCollapsed}}">

<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{ThemeResource NavigationTabBarItemOnErrorBrush}"
MaxLines="1"
Style="{StaticResource LabelExtraSmall}"
Text="{TemplateBinding BadgeValue}"
TextAlignment="Center" />

</Border>
</Grid>
<!-- InfoBadge Presenter -->

<!-- TODO: Uncomment this when https://github.com/unoplatform/uno.toolkit.ui/pull/1142 is merged and the Toolkit version is updated -->
<!--<ContentPresenter x:Name="InfoBadgePresenter"
Content="{TemplateBinding InfoBadge}"
Margin="{ThemeResource NavigationTabBarItemLargeBadgeMargin}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Visibility="{Binding InfoBadge, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToCollapsedConverter}}" />-->
</Grid>
</utu:ShadowContainer>

Expand Down Expand Up @@ -2638,42 +2611,15 @@
</Border>

<!-- BADGE -->
<!-- This part can be replaced when InfoBadge will be available in WinUI3 -->
<!-- See this commit for the implementation: c935919b2c390014dd8509cc50e16b1549511ffa -->
<!-- (Related Branch: dev/agzi/I274-InfoBadgeImplementationForTBI) -->

<Grid Visibility="{TemplateBinding BadgeVisibility}">
<!-- Small Badge -->
<Ellipse Width="{ThemeResource NavigationTabBarItemSmallBadgeWidth}"
Height="{ThemeResource NavigationTabBarItemSmallBadgeHeight}"
Margin="{ThemeResource NavigationTabBarItemSmallBadgeMargin}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Fill="{ThemeResource NavigationTabBarItemErrorBrush}"
Visibility="{Binding BadgeValue, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToVisible}}" />


<!-- Large Badge -->
<Border Height="{ThemeResource NavigationTabBarItemLargeBadgeHeight}"
MinWidth="{ThemeResource NavigationTabBarItemLargeBadgeMinWidth}"
Margin="{ThemeResource NavigationTabBarItemLargeBadgeMargin}"
Padding="{ThemeResource NavigationTabBarItemLargeBadgePadding}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="{ThemeResource NavigationTabBarItemErrorBrush}"
CornerRadius="{ThemeResource NavigationTabBarItemLargeBadgeCornerRadius}"
Visibility="{Binding BadgeValue, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToCollapsed}}">

<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{ThemeResource NavigationTabBarItemOnErrorBrush}"
MaxLines="1"
Style="{StaticResource LabelExtraSmall}"
Text="{TemplateBinding BadgeValue}"
TextAlignment="Center" />

</Border>
</Grid>
<!-- InfoBadge Presenter -->

<!-- TODO: Uncomment this when https://github.com/unoplatform/uno.toolkit.ui/pull/1142 is merged and the Toolkit version is updated -->
<!--<ContentPresenter x:Name="InfoBadgePresenter"
Content="{TemplateBinding InfoBadge}"
Margin="{ThemeResource NavigationTabBarItemLargeBadgeMargin}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Visibility="{Binding InfoBadge, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToCollapsedConverter}}" />-->
</Grid>
<Grid x:Name="ContentPresenterGrid"
Grid.Row="1"
Expand Down Expand Up @@ -2857,7 +2803,7 @@
</Viewbox>

<!-- Icon/Content spacing -->
<Border Visibility="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToCollapsed}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
<Border Visibility="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}">
<Border Width="{ThemeResource FabTabBarItemIconTextPadding}"
Visibility="{Binding Path=Icon, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NullToCollapsedConverter}, FallbackValue=Collapsed, TargetNullValue=Collapsed}" />
</Border>
Expand Down
Loading