Xamarin.forms: [Bug] UWP NavigationPage.TitleView does not fill Header

Created on 21 Nov 2019  路  6Comments  路  Source: xamarin/Xamarin.Forms

Description

On UWP the TitleView does not take up all the available space. There is a margin at the bottom and left.

Steps to Reproduce

````xaml


BackgroundColor="Red"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />

<Grid BackgroundColor="Yellow">

</Grid>


````

Expected Behavior

Grid with BackgroundColor="Red" Fill Header without margins:
image

Actual Behavior

Grid has Left 10px and Bottom 8px Margin:
image
Live Visual Tree of Header:
image
It is the Border in TitleViewPresenter that takes width=10px and height=48px. This one should have Visibility=Collapsed.

Basic Information

  • Version with issue: 4.3.0.991211
  • IDE: 16.3.10
  • Platform Target Frameworks:

    • UWP: 18362

titleview 3 high impact UWP bug

Most helpful comment

My temp workaround (hide TextBlock of Title in entire app):
````xaml

<x:Double x:Key="AppBarThemeCompactHeight">48</x:Double>
<x:Double x:Key="AppBarExpandButtonThemeWidth">0</x:Double>


``` In my opinion, the [Title TextBlock](https://github.com/xamarin/Xamarin.Forms/blob/f06cb1f652ca5feac719a20cac98c9a61fd461aa/Xamarin.Forms.Platform.UAP/PageControlStyle.xaml#L35) should be collapsed when noTitle` provided.

All 6 comments

Hm I wonder if this has some connection to what is going on in #5661

@jfversluis Thanks! This also fixes the left "Padding" on TitleView?

Hm that I don't think so, this focusses mostly on the bottom thing. But it should be in the same area

Confirmed this happening in the attached repro project.

Repro8602.zip

I've tried to look into this. It appears the implementation of the TitleView in UWP is such, that it co-exists with the TitleIcon and Title properties, and this is causing the problems.

This becomes more obvious if a Title is added to the repro @jfversluis provided:
2019-12-26

Note how the "Title" intrudes on the TitleView.

The left padding is caused by these lines in the default PageControlStyle - where a grid with 3 columns are used: one for any icon, one for the title, and one for the TitleView. As the TextBlock for the Title includes a left padding of 10, this is always there.

I can fix this, but I need to be sure my understanding is correct: that if a TitleView is specified, this should take precedence, and neither the Icon ot the Title property should be shown; but if no TitleView is specified, the Icon and Title should be shown.

?

My temp workaround (hide TextBlock of Title in entire app):
````xaml

<x:Double x:Key="AppBarThemeCompactHeight">48</x:Double>
<x:Double x:Key="AppBarExpandButtonThemeWidth">0</x:Double>


``` In my opinion, the [Title TextBlock](https://github.com/xamarin/Xamarin.Forms/blob/f06cb1f652ca5feac719a20cac98c9a61fd461aa/Xamarin.Forms.Platform.UAP/PageControlStyle.xaml#L35) should be collapsed when noTitle` provided.

Was this page helpful?
0 / 5 - 0 ratings