Setting background image based on Idiom in Xaml.

ahmadmadiahmadmadi USMember ✭✭✭

Hello I have this peice of code that works fine but it is in the code behind , is there a way to write that in Xaml ?

public partial class TestFormsPage : ContentPage
    {
        public TestFormsPage()
        {
            if (Device.Idiom == TargetIdiom.Tablet)
            {
                BackgroundImage = "darkBackground_Tablet.jpg";
            }
            if (Device.Idiom == TargetIdiom.Phone)
            {
                BackgroundImage = "DarkBackgroundPhone.jpg";
            }
            InitializeComponent();
        }
    }

Best Answers

Answers

  • ahmadmadiahmadmadi USMember ✭✭✭

    Thanks @AlessandroCaliaro but I am asking also about the background Image for the page, like what shuold I have for "x:TypeArguments" ?

Sign In or Register to comment.