xamarin/Xamarin.Forms

[Bug] Style not applied on ViewCell in a TableView

Aperta

#7062 aperta il 3 ago 2019

 (2 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
4.1.0a/CSSa/listviewe/2 :clock2:help wantedi/regressionp/Androids/unverifiedt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

It seems like styles defined in a css file don't apply to contents of a viewcell in a tableview

Steps to Reproduce

New Mobile Application (Xamarin forms) in Visual Studio then this in the MainPage.xaml:

    <ContentPage.Resources>
        <StyleSheet Source="/Styles/AppStyle.css" />
    </ContentPage.Resources>

    <StackLayout>
        <Label Text="Error!" StyleClass="error" />
        <TableView Intent="Form">
            <TableRoot>
                <TableSection>
                    <ViewCell>
                        <StackLayout Orientation="Horizontal">
                            <Label Text="Test" />
                            <Entry Placeholder="Enter something" />
                            <Label Text="Error" StyleClass="error" />
                        </StackLayout>
                    </ViewCell>
                </TableSection>
            </TableRoot>
        </TableView>
    </StackLayout>

and this in the Styles/AppStyle.css:

Label.error {
    color: red;
}

Expected Behavior

Both Label with the StyleClass="error" should have a text-color of red.

Actual Behavior

The text in the Label inside the tableview is black.

Basic Information

I haven't actually tested this against multiple devices, just with the one android emulator (on Windows) that I use.

  • Version with issue: 4.1.0.618606
  • Last known good version: unknown
  • IDE: Visual Studio 2019 16.2.0
  • Platform Target Frameworks:
    • Android: 9.0
  • Android Support Library Version: I have some v7 support nuget packages (but only those installed by default with the Visual Studio template)
  • Nuget Packages: only standard
  • Affected Devices: Pixel 2

Screenshots

Screenshot_1564845478

Guida contributor