【问题标题】:Xamarin.Forms Picker Selection BackgroundColorXamarin.Forms 选取器选择背景颜色
【发布时间】:2021-12-19 02:16:00
【问题描述】:

我正在寻找有关如何在 Xamarin 表单中更改选择器颜色(日期和时间)的适当解决方法。我已经有自定义渲染器来自定义对话框,但是是否也有类似的可能性可以同时在所有实例上自定义显示的选取器本身(以及烦人的粉红色线)的背景颜色? 我发现了如何制作它,但我的解决方案并不那么优雅,因为我必须在整个应用程序的每个实例上定义背景颜色。

-> 我希望 16:00 后面的蓝框消失

我的图片代码如下:

               <TimePicker Grid.Row="5"
                            Grid.Column="0"
                            x:Name="BtnTime2"
                            Format="t"/>

                <Button Grid.Row="5"
                        Grid.Column="1"
                        x:Name="BtnTime2Now"
                        CornerRadius="15"/>

                <DatePicker Grid.Row="6"
                            Grid.Column="0"
                            Grid.ColumnSpan="2"
                            x:Name="BtnDate"
                            Format="D"
                            BackgroundColor="#00000000"/>

希望你们中的任何人都可以帮助我

【问题讨论】:

    标签: android xamarin.forms material-design-in-xaml


    【解决方案1】:

    好吧,没关系... 我的 App.xaml 中已经有了解决方案

    <Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Arbeitszeitrechner_Forms.App">
    <Application.Resources>
        <ResourceDictionary>
            
            ...some more Styles here...
    
            <Style TargetType="TimePicker">
                <Setter Property="BackgroundColor" Value="#00000000"/>
                <Setter Property="TextColor" Value="{StaticResource Text}"/>
            </Style>
            <Style TargetType="DatePicker">
                <Setter Property="BackgroundColor" Value="#00000000"/>
                <Setter Property="TextColor" Value="{StaticResource Text}"/>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
    

    【讨论】:

      猜你喜欢
      • 2018-10-13
      • 2014-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-28
      • 1970-01-01
      相关资源
      最近更新 更多