Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Xamarin Forms Title View not centered on non modal screens (With a back button) #5862

Closed
killer-frog opened this issue Apr 9, 2019 · 2 comments
Labels
s/unverified New report that has yet to be verified

Comments

@killer-frog
Copy link

Description

When creating a title view, centered label is off centered on non modal screens, with a back button.

Steps to Reproduce

Create a custom TitleView

    <ContentView.Content>
        <Grid HorizontalOptions="FillAndExpand" Margin="0">

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="40" />
            </Grid.ColumnDefinitions>
            <Label Text="{Binding Title}" Grid.Row="0" Grid.ColumnSpan="2" Style="{StaticResource HeaderTitle}" >
                <Label.HorizontalOptions>
                    <OnPlatform x:TypeArguments="LayoutOptions">
                        <On Platform="iOS" Value="Center" />
                        <On Platform="Android" Value="Start" />
                    </OnPlatform>
                </Label.HorizontalOptions>
            </Label>
            <forms:SvgCachedImage x:Name="MainImage" HeightRequest="30" Grid.Row="0" Grid.Column="1"
                                  Source="{Binding CurrentConnectionStatus, Converter={StaticResource BluetoothStatusConverter}}"
                                  HorizontalOptions="End" />
        </Grid>
    </ContentView.Content>

Then set the TitleView to use the control

            defaultTitleView = new DefaultTitleView();
            NavigationPage.SetTitleView(this, defaultTitleView);

Expected Behavior

The Title Should be centered on the screen

Actual Behavior

It appears to be centered between the right of the Back button and the Right of the screen. This is even more pronounced on Android where the back button is larger.

Screenshot 2019-04-09 at 16 00 39

Basic Information

  • Version with issue: 3.6.0.264807
  • Last known good version: n/a
  • IDE: Visual Studio (mac) v8.0
  • Platform Target Frameworks:
    • iOS: 12.1
    • Android: 8.1
  • Android Support Library Version: v7
  • Nuget Packages:
  • Affected Devices: iOS & Android Devices
@samhouts samhouts added the s/unverified New report that has yet to be verified label Apr 9, 2019
@samhouts
Copy link
Member

Duplicate of #4848

@samhouts samhouts marked this as a duplicate of #4848 Apr 12, 2019
@rs-mobitech
Copy link

This has been marked as a duplicate but the duplicate has been closed with no solution

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
s/unverified New report that has yet to be verified
Projects
None yet
Development

No branches or pull requests

3 participants