VS Tabbed template NewItemPage...Background black, but no style to set it??

Terrence7 1 Reputation point
2021-04-06T21:42:16.527+00:00

File new project, Xamarin.Forms, Tabbed project.

Look at NewItemPage.xaml. The background is black, but I can't tell what is styling it that way.

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="App1Tabbed.Views.NewItemPage"
             Shell.PresentationMode="ModalAnimated"
             Title="New Item">

    <ContentPage.Content>
        <StackLayout Spacing="3" Padding="15">
            <Label Text="Text" FontSize="Medium" />
            <Entry Text="{Binding Text, Mode=TwoWay}" FontSize="Medium" />
            <Label Text="Description" FontSize="Medium" />
            <Editor Text="{Binding Description, Mode=TwoWay}" AutoSize="TextChanges" FontSize="Medium" Margin="0" />
            <StackLayout Orientation="Horizontal">
                <Button Text="Cancel" Command="{Binding CancelCommand}" HorizontalOptions="FillAndExpand"></Button>
                <Button Text="Save" Command="{Binding SaveCommand}" HorizontalOptions="FillAndExpand"></Button>
            </StackLayout>
        </StackLayout>
    </ContentPage.Content>

</ContentPage>
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,706 Reputation points Microsoft Vendor
    2021-04-07T08:40:37.317+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    According to your step , I did a test, the default background color of my page (including NewItemPage) is white.

    I used the latest version of nuget xamarin forms and visual studio ide.

    If you want to change the style of page, you can define our style in file App.xaml and AppShell.xaml.

    For example, the default code of App.xaml is as follows, and we can define out style as we want :

    <Application.Resources>  
        <ResourceDictionary>  
            <Color x:Key="Primary">#2196F3</Color>  
            <Style TargetType="Button">  
                <Setter Property="TextColor" Value="White"></Setter>  
                <Setter Property="VisualStateManager.VisualStateGroups">  
                    <VisualStateGroupList>  
                        <VisualStateGroup x:Name="CommonStates">  
                            <VisualState x:Name="Normal">  
                                <VisualState.Setters>  
                                    <Setter Property="BackgroundColor" Value="{StaticResource Primary}" />  
                                </VisualState.Setters>  
                            </VisualState>  
                            <VisualState x:Name="Disabled">  
                                <VisualState.Setters>  
                                    <Setter Property="BackgroundColor" Value="#332196F3" />  
                                </VisualState.Setters>  
                            </VisualState>  
                        </VisualStateGroup>  
                    </VisualStateGroupList>  
                </Setter>  
            </Style>  
        </ResourceDictionary>          
    </Application.Resources>  
    

    Best Regards,

    Jessie Zhang

    ---
    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments