Xamarin Forms OnPlatform in Xaml

前端 未结 2 678
慢半拍i
慢半拍i 2021-01-18 14:41

I have the following C# code:

var footer = new StackLayout()
            { BackgroundColor = Device.OnPlatform(Color.FromRgb(225, 240, 251), Color.FromRgb(22         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-18 14:50

    You're almost there. The default converter takes care of converting the color from either a named color (e.g. White, Red, etc.) or a hex color (e.g.: #FF0000).

    
        
            #FF0000
            #00FF00
        
    
    

提交回复
热议问题