Xamarin.Forms 单击 ListView ViewCell 背景颜色更改为橙​​色,但未初始化为颜色

Raj*_*zer 2 xamarin.ios xamarin.android xamarin.forms

这是我的代码

<ListView x:Name="listViewClient"  ItemsSource="{Binding Client}" HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell >


                        <Grid  Margin="10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <BoxView  Grid.Column="0" Color="#84DCC6"/>
                            <StackLayout Grid.Column="1" Padding="20, 10">

                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                <Label Text="Name:" FontSize="16" />
                                <Label FontSize="Medium" Text="{Binding Name}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                    <Label Text="Adress:"  FontSize="16"/>
                                <Label FontSize="Medium" Text="{Binding Adress}" FontAttributes="Bold"/>
                                    </StackLayout>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                    <Label Text="Place:"  FontSize="16"/>
                                    <Label FontSize="Medium" Text="{Binding Place}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>

                                <Frame BorderColor="WhiteSmoke" >
                                    <Grid >

                                    <StackLayout Grid.Column="0">
                                    <Label Text="Mobile:"  FontSize="16"/>
                                    <Label  FontSize="Medium" Text="{Binding Mobile}" FontAttributes="Bold" />
                                    </StackLayout>
                                        <Button Grid.Column="1" Text="Call" Clicked="PovikajPartnerClicked" BackgroundColor="#84DCC6"></Button>
                                    </Grid>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                        <Label Text="?-mail:"  FontSize="16"/>
                                        <Label FontSize="Medium" Text="{Binding EMAIL}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>
                                <Frame BorderColor="WhiteSmoke">
                                    <StackLayout>
                                        <Label Text="LAW:"  FontSize="16"/>
                                        <Label FontSize="Medium" Text="{Binding LAW}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>

                                <Frame BorderColor="WhiteSmoke
                                       ">
                                    <StackLayout>
                                <Label Text="SECNUM:"  FontSize="16"/>
                                <Label FontSize="Medium" Text="{Binding SECNUM}" FontAttributes="Bold" />
                                    </StackLayout>
                                </Frame>

                            </StackLayout>
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

Run Code Online (Sandbox Code Playgroud)

当我点击列表视图时,我不知道从哪里获得橙色背景颜色。从代码中您可以看到我没有选择 samo 背景颜色。是否有默认的点击事件使颜色变为橙色?我尝试了所有方法,但找不到任何我忘记添加颜色的地方。

Sim*_*rwa 5

我知道这可能有点晚了,但我希望它会对某人有所帮助,只需转到 AppName.Android/Resources/values 下的 style.xml 文件并在您的主主题中添加以下内容:

<item name="android:colorActivatedHighlight">@android:color/transparent</item>
Run Code Online (Sandbox Code Playgroud)