简体   繁体   English

Xamarin表单更改SwichCell文本颜色

[英]Xamarin forms change SwichCell Text Color

Is it possible to change the text color of xamarins SwichCell ? 是否可以更改xamarins SwichCell的文本颜色?

At the moment the text in my SwichCell is colored gray, and I want to change it to black. 目前,我的SwichCell中的文本为灰色,我想将其更改为黑色。

My xaml looks like this: 我的xaml看起来像这样:

..

<TableView Intent="Data" >
    <TableRoot>;
        <TableSection>
            <SwitchCell Text="Allow Push Notifications"/>
        </TableSection>
        <TableSection>
            <ViewCell>
                <ViewCell.View>
                    <Button Grid.Column="1" Text="Log Out" Clicked="LogOutButtonClick" Margin="-20,-20,-20,-20"/>
            </ViewCell.View>
         </ViewCell>
        </TableSection>
        <TableSection>
            <TextCell Text="Android Version 1.2.1" TextColor="Black"/>
        </TableSection>
    </TableRoot>
</TableView>

The only thing regarding this I found here but the example is only for IOS and the other provided solutions uses TextCell and Swich combination, which does not fit my scenario (I think) 我在这里找到的唯一与此相关的东西,但示例仅适用于IOS,其他提供的解决方案使用TextCell和Swich组合,这不适合我的情况(我认为)

Someone has linked a stackoverflow answer regarding Swich here . 有人在这里链接了有关Swich的stackoverflow答案。 But it does not work for my situacion since I'm using SwichCell and it does not have the properties that are listed in that answer(also it only has an android version) 但这不适用于我的情况,因为我使用的是SwichCell,并且它不具有该答案中列出的属性(而且它仅具有android版本)

If the SwitchCell doesn't expose a BackgroundColor Property, you can just wrap the Switch Control in its own ViewCell. 如果SwitchCell不公开BackgroundColor属性,则可以将Switch控件包装在其自己的ViewCell中。

Can't Confirm the syntax, but something like this: 无法确认语法,但类似这样:

 <ViewCell>
    <StackLayout>
       <Switch BackgroundColor="Black"/>
     </StackLayout>
 </ViewCell>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM