ispiro ispiro - 1 year ago 102
C# Question

Change button color on single target

I have a Xamarin Forms project (Portable) and see that the colors on one target (UWP) aren't that good. I want to change the color of a button on that target only, but I can't find how to do that.

I've looked at the files, but it seems to load the whole

LoadApplication(new TheApp.App());
as a whole.

Answer Source

use Device to customize properties per platform

myButton.BackgroundColor = Color.Green;

// on Windows only, change color
if (Device.OS == TargetPlatform.Windows) {
  myButton.BackgroundColor = Color.Blue;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download