xamarin/Xamarin.Forms

[Bug] Style not applied on ViewCell in a TableView

Open

#7,062 opened on Aug 3, 2019

 (2 comments) (0 reactions) (0 assignees)C# (1,926 forks)batch import
4.1.0a/CSSa/listviewe/2 :clock2:help wantedi/regressionp/Androids/unverifiedt/bug :bug:up-for-grabs

Repository metrics

Stars
 (5,644 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

Contributor guide