Home > Software engineering >  XamarinForms iOS - Weird Shell shadow
XamarinForms iOS - Weird Shell shadow

Time:10-21

I'm working around with Xamarin Forms and today I've realized weird thing on iOS in my app. The top Shell items (usually back button and page title) now have some weird shadow and I can't figure out how to disable it. Could someone help me with this please?

enter image description here

Those two items:

<Shell.BackButtonBehavior>
    <BackButtonBehavior Command="{Binding BackButtonCommand}" IconOverride="ic_arrow_green_left" />
</Shell.BackButtonBehavior>

<Shell.TitleView>
    <Grid Style="{StaticResource NavBarGridWrapper}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="50" />
        </Grid.ColumnDefinitions>
        <Label Style="{StaticResource NavBarMainTitle}" Text="{Binding Source={x:Static appResources:Resource.SettingsTitle}, Converter={StaticResource StringToUpper}}" />
    </Grid>
</Shell.TitleView>

App.xaml:

<!--  NavBar  -->
        <Style
            x:Key="NavBarGridWrapper"
            TargetType="Grid">
            <!--<Setter Property="HorizontalOptions" Value="Fill" />
            <Setter Property="VerticalOptions" Value="Fill" />-->
        </Style>
        <Style
            x:Key="NavBarMainTitle"
            TargetType="Label">
            <Setter Property="FontFamily" Value="{StaticResource MontserratBold}" />
            <Setter Property="FontSize" Value="{DynamicResource MediumFontSize}" />
            <Setter Property="TextColor" Value="{StaticResource DarkGrayText}" />
            <Setter Property="VerticalOptions" Value="Center" />
        </Style>

CodePudding user response:

In my case worked setting up NavBarHasShadow in page code behind:

public partial class HomeView : ContentPage
{
    public HomeView()
    {
        InitializeComponent();

        Shell.SetNavBarHasShadow(this, false);
    }
}

CodePudding user response:

You can set it in your appshell.xaml :

   <Style x:Key="BaseStyle" TargetType="Element">
          .....
            <Setter Property="Shell.NavBarHasShadow" Value="False" />
        </Style>
  • Related