maui icon indicating copy to clipboard operation
maui copied to clipboard

NavigationPage.TitleView displays incorrectly on Windows

Open RWSchwabXXX opened this issue 2 years ago • 5 comments
trafficstars

Description

When using a custom NavigationPage.TitleView compiled for Windows it displays incorrectly. partial screenshots of identical code run on Windows and Andriod are below. The windows version pushes everything to the start of the Title view and only extends the width of the encompasing grid to the largest child - rather than the width of the window. Setting HorizontalOptions on the grid (or any of the children) to fill do not change affect the display.

Windows image

Android image

The ImageButton also displays differently, but that is of minor importance.

Steps to Reproduce

Set the NavigationPage.TitleView in XAML for a ContentPage.

  <NavigationPage.TitleView>
    <Grid  >
      <Label Text="Home Page" HorizontalOptions="StartAndExpand" VerticalOptions="Center" TextColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource White}}" FontSize="Large"   />
      <Button Text="test" HorizontalOptions="Center" ImageSource="plus32.png" TextColor="White" />
      <ImageButton Command="{x:Binding TakePicture}" Source="camera_plus_32.png" HorizontalOptions="End" HeightRequest="32"/>
    </Grid>
  </NavigationPage.TitleView>

The content page is used to instantiate the main NavigationPage:

  public App(IServiceProvider services) {
    InitializeComponent();
    MainPage = new NavigationPage(services.GetService<Pages.PhotosHomePage>());
  }

Link to public reproduction project repository

https://github.com/RWSchwabXXX/TitleviewProblemRepro

Version with bug

8.0.0-preview.6.8686

Last version that worked well

unknown

Affected platforms

Windows

Affected platform versions

windows10.0.19041.0

Did you find any workaround?

Setting the WidthRequest of the grid within the TitleView helps, but it would need to be bound to the window width.

Relevant log output

No response

RWSchwabXXX avatar Jul 13 '23 20:07 RWSchwabXXX

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

ghost avatar Jul 17 '23 14:07 ghost

Verified this on Visual Studio Enterprise 17.7.0 Preview 6.0. Repro on Windows 11(8.0.100-preview.6.23330.14), not repro on Android 13.0-API33 and iOS 16.4 with below Project: TitleviewProblemRepro.zip

XamlTest avatar Aug 08 '23 05:08 XamlTest

Yes, the NavigationBar TitleView does not expand to occupy the entire title bar even if the HorizontalOptions of the container control is set to Fill. Issue in the Windows platform.

<NavigationPage.TitleView>
  <Grid BackgroundColor="Yellow"><Label Text="Home" /></Grid>
</NavigationPage.TitleView>

egvijayanand avatar Jan 03 '24 13:01 egvijayanand