Creating a user interface for Windows 8.1 applications using only C # without xaml

Is it possible to create a page in Windows 8.1 using only C # code. If so, how is this done?

I tried to execute the following code:

namespace App6
{
    class Login: Page
    {

        Grid grd;

        public Login()
        { 
            grd = new Grid();

            grd.Height = Window.Current.Bounds.Height;
            grd.Width = Window.Current.Bounds.Width;
            grd.Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Color.FromArgb(255,255, 255, 217));
        }
    }
}

Then I tried to go to this page using this.Frame.Navigate (typeof (Login)) from the main page, but this throws a System.TypeLoadException in which it was not possible to find the Windows runtime type Windows.Foundation

What is the correct way to create and navigate a page created using only C #?

+4
source share

Source: https://habr.com/ru/post/1547152/


All Articles