Skip to content

Commit

Permalink
Merge pull request #1302 from unoplatform/dev/mara/fix-appbarbutton-n…
Browse files Browse the repository at this point in the history
…avbar

fix: AppBarButton inside NavigationBar keeps rendering on every click
  • Loading branch information
rajamatt authored Dec 10, 2024
2 parents 5157274 + 0bccb63 commit c84aa79
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</Grid.RowDefinitions>
<utu:NavigationBar Content="First Page"
MainCommandMode="Action"
AutomationProperties.AutomationId="FluentPage1NavBar"
Style="{StaticResource DefaultNavigationBar}">
<utu:NavigationBar.MainCommand>
<AppBarButton Click="NavigateBack"
Expand All @@ -42,6 +43,11 @@
<BitmapIcon UriSource="ms-appx:///Assets/AppleIcon_Small.png" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Click="NavigateToNextPage"
Label="Page2"
AutomationProperties.AutomationId="FluentPage1NavBarPrimaryCommand3"
Style="{StaticResource DefaultAppBarButtonStyle}"
Icon="Favorite" />
</utu:NavigationBar.PrimaryCommands>
<utu:NavigationBar.SecondaryCommands>
<AppBarButton Command="{Binding Secondary1CountCommand}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<utu:NavigationBar Content="Second Page"
AutomationProperties.AutomationId="FluentPage2NavBar"
Style="{StaticResource DefaultNavigationBar}">
<utu:NavigationBar.PrimaryCommands>
<AppBarButton Label="More"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ protected override IEnumerable<IDisposable> Initialize()
new[] { AppBarButton.LabelProperty },
new[] { AppBarButton.IconProperty },
new[] { AppBarButton.IconProperty, BitmapIcon.UriSourceProperty },
new[] { AppBarButton.IconProperty, IconElement.ForegroundProperty },
new[] { AppBarButton.IconProperty, IconElement.ForegroundProperty, SolidColorBrush.ColorProperty },
new[] { AppBarButton.ContentProperty },
new[] { AppBarButton.ContentProperty, FrameworkElement.VisibilityProperty },
new[] { AppBarButton.OpacityProperty },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,19 @@ public void NavBar_Page_Can_Go_Back()

App.WaitForNoElement("M3Page2NavBar", "Timed out waiting for no Page 2 Nav Bar");
}

[Test]
[AutoRetry]
public void NavBar_AppBarButton_With_Icon_Click()
{
NavigateToNestedSample("FluentNavigationBarSampleNestedPage");

PlatformHelpers.On(
iOS: () => App.Tap("FluentPage1NavBarPrimaryCommand3"),
Android: () => App.Tap("FluentPage1NavBarPrimaryCommand3")
);

App.WaitForElement("FluentPage2NavBar", "Timed out waiting for Page 2 Nav Bar");
}
}
}

0 comments on commit c84aa79

Please sign in to comment.