簡體   English   中英

Xamarin.Forms 選擇器選擇背景顏色

[英]Xamarin.Forms Picker Selection BackgroundColor

我正在尋找有關如何在 Xamarin Forms 中更改選取器顏色(日期和時間)的正確解決方法。 我已經有了自定義渲染器來自定義對話框,但是是否也有類似的可能性可以一次在所有實例上自定義顯示的選取器本身(以及煩人的粉紅色線)的背景顏色? 我找到了如何制作它,但我的解決方案不是那么優雅,因為我必須在整個應用程序的每個實例上定義背景顏色。 我希望 16:00 后面的藍框消失

-> 我希望 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"/>

希望你們中的任何人都可以幫助我

好吧沒關系...我已經在我的 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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM