Ejemplo n.º 1
0
        public void Run()
        {
            Styles.Add(new DefaultTheme());

            var loader    = new PerspexXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Perspex.Themes.Default.Accents.BaseLight.xaml?assembly=Perspex.Themes.Default"));

            Styles.Add(baseLight);

            Styles.Add(new SampleTabStyle());
            DataTemplates = new DataTemplates
            {
                new FuncTreeDataTemplate <Node>(
                    x => new TextBlock {
                    Text = x.Name
                },
                    x => x.Children),
            };

            MainWindow.RootNamespace = "TestApplication";
            var wnd = MainWindow.Create();

            wnd.AttachDevTools();

            Run(wnd);
        }
Ejemplo n.º 2
0
 private void InitializeComponent()
 {
     PerspexXamlLoader.Load(this);
     _carousel = this.FindControl <Carousel>("carousel");
     _left     = this.FindControl <Button>("left");
     _right    = this.FindControl <Button>("right");
 }
Ejemplo n.º 3
0
        public void StyleResource_Can_Be_Assigned_To_StyleResource_Property()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml = @"
<Window xmlns='https://github.com/perspex'
        xmlns:mut='https://github.com/perspex/mutable'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <Window.Styles>
        <Style>
            <Style.Resources>
                <Color x:Key='color'>#ff506070</Color>
                <mut:SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
            </Style.Resources>
        </Style>
    </Window.Styles>
    <Button Name='button' Background='{StyleResource brush}'/>
</Window>";

                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var brush  = (Perspex.Media.Mutable.SolidColorBrush)window.FindStyleResource("brush");
                var button = window.FindControl <Button>("button");

                DelayedBinding.ApplyBindings(button);

                var buttonBrush = (Perspex.Media.Mutable.SolidColorBrush)button.Background;

                Assert.Equal(0xff506070, brush.Color.ToUint32());
                Assert.Equal(0xff506070, buttonBrush.Color.ToUint32());
            }
        }
Ejemplo n.º 4
0
        public void DataTemplate_Can_Contain_Name()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
        xmlns:sys='clr-namespace:System;assembly=mscorlib'>
    <Window.DataTemplates>
        <DataTemplate DataType='{Type sys:String}'>
            <Canvas Name='foo'/>
        </DataTemplate>
    </Window.DataTemplates>
    <ContentControl Name='target' Content='Foo'/>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var target = window.FindControl <ContentControl>("target");

                window.ApplyTemplate();
                target.ApplyTemplate();
                ((ContentPresenter)target.Presenter).UpdateChild();

                Assert.IsType <Canvas>(target.Presenter.Child);
            }
        }
Ejemplo n.º 5
0
        private static void UpdateXaml(string xaml)
        {
            Window  window;
            Control original;

            using (PlatformManager.DesignerMode())
            {
                var loader = new PerspexXamlLoader();
                var stream = new MemoryStream(Encoding.UTF8.GetBytes(xaml));

                original = (Control)loader.Load(stream);
                window   = original as Window;

                if (window == null)
                {
                    window = new Window()
                    {
                        Content = original
                    };
                }

                if (!window.IsSet(Window.SizeToContentProperty))
                {
                    window.SizeToContent = SizeToContent.WidthAndHeight;
                }
            }

            s_currentWindow?.Close();
            s_currentWindow = window;
            window.Show();
            Design.ApplyDesignerProperties(window, original);
            Api.OnWindowCreated?.Invoke(window.PlatformImpl.Handle.Handle);
            Api.OnResize?.Invoke();
        }
Ejemplo n.º 6
0
        public void StyleResource_Can_Be_Assigned_To_Setter()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml = @"
<Window xmlns='https://github.com/perspex'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <Window.Styles>
        <Style>
            <Style.Resources>
                <SolidColorBrush x:Key='brush'>#ff506070</SolidColorBrush>
            </Style.Resources>
        </Style>
        <Style Selector='Button'>
            <Setter Property='Background' Value='{StyleResource brush}'/>
        </Style>
    </Window.Styles>
    <Button Name='button'/>
</Window>";

                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var button = window.FindControl <Button>("button");
                var brush  = (SolidColorBrush)button.Background;

                Assert.Equal(0xff506070, brush.Color.ToUint32());
            }
        }
Ejemplo n.º 7
0
 public App()
 {
     RegisterServices();
     InitializeSubsystems((int)Environment.OSVersion.Platform);
     Styles = new DefaultTheme();
     PerspexXamlLoader.Load(this);
 }
Ejemplo n.º 8
0
        public void StyleResource_Can_Be_Assigned_To_Property()
        {
            var xaml = @"
<UserControl xmlns='https://github.com/perspex'
             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <UserControl.Styles>
        <Style>
            <Style.Resources>
                <SolidColorBrush x:Key='brush'>#ff506070</SolidColorBrush>
            </Style.Resources>
        </Style>
    </UserControl.Styles>

    <Border Name='border' Background='{StyleResource brush}'/>
</UserControl>";

            var loader      = new PerspexXamlLoader();
            var userControl = (UserControl)loader.Load(xaml);
            var border      = userControl.FindControl <Border>("border");

            DelayedBinding.ApplyBindings(border);

            var brush = (SolidColorBrush)border.Background;

            Assert.Equal(0xff506070, brush.Color.ToUint32());
        }
Ejemplo n.º 9
0
        public void Binding_Should_Be_Assigned_To_Setter_Value_Instead_Of_Bound()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
            {
                var xaml = "<Style xmlns='https://github.com/perspex'><Setter Value='{Binding}'/></Style>";
                var loader = new PerspexXamlLoader();
                var style = (Style)loader.Load(xaml);
                var setter = (Setter)(style.Setters.First());

                Assert.IsType<Binding>(setter.Value);
            }                
        }
Ejemplo n.º 10
0
        public void Binding_Should_Be_Assigned_To_ItemsSource_Instead_Of_Bound()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
            {
                var xaml = "<DataTemplates xmlns='https://github.com/perspex'><TreeDataTemplate ItemsSource='{Binding}'/></DataTemplates>";
                var loader = new PerspexXamlLoader();
                var templates = (DataTemplates)loader.Load(xaml);
                var template = (TreeDataTemplate)(templates.First());

                Assert.IsType<Binding>(template.ItemsSource);
            }                
        }
Ejemplo n.º 11
0
        public void Binding_Should_Be_Assigned_To_ItemsSource_Instead_Of_Bound()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
            {
                var xaml      = "<DataTemplates xmlns='https://github.com/perspex'><TreeDataTemplate ItemsSource='{Binding}'/></DataTemplates>";
                var loader    = new PerspexXamlLoader();
                var templates = (DataTemplates)loader.Load(xaml);
                var template  = (TreeDataTemplate)(templates.First());

                Assert.IsType <Binding>(template.ItemsSource);
            }
        }
Ejemplo n.º 12
0
        public void Binding_Should_Be_Assigned_To_Setter_Value_Instead_Of_Bound()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
            {
                var xaml   = "<Style xmlns='https://github.com/perspex'><Setter Value='{Binding}'/></Style>";
                var loader = new PerspexXamlLoader();
                var style  = (Style)loader.Load(xaml);
                var setter = (Setter)(style.Setters.First());

                Assert.IsType <Binding>(setter.Value);
            }
        }
Ejemplo n.º 13
0
        /// <inheritdoc/>
        public void Attach(IStyleable control, IStyleHost container)
        {
            if (Source != null)
            {
                if (Loaded == null)
                {
                    var loader = new PerspexXamlLoader();
                    Loaded = (IStyle)loader.Load(Source);
                }

                Loaded.Attach(control, container);
            }
        }
Ejemplo n.º 14
0
        /// <inheritdoc/>
        public void Attach(IStyleable control, IStyleHost container)
        {
            if (Source != null)
            {
                if (Loaded == null)
                {
                    var loader = new PerspexXamlLoader();
                    Loaded = (IStyle)loader.Load(Source);
                }

                Loaded.Attach(control, container);
            }
        }
Ejemplo n.º 15
0
            public DesignerApp()
            {
                RegisterServices();
                //For now we only support windows
                InitializeSubsystems(2);
                Styles.Add(new DefaultTheme());

                var loader    = new PerspexXamlLoader();
                var baseLight = (IStyle)loader.Load(
                    new Uri("resm:Perspex.Themes.Default.Accents.BaseLight.xaml?assembly=Perspex.Themes.Default"));

                Styles.Add(baseLight);
            }
Ejemplo n.º 16
0
        private static Styles CreateDefaultTheme()
        {
            var result = new Styles
            {
                new DefaultTheme(),
            };

            var loader    = new PerspexXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Perspex.Themes.Default.Accents.BaseLight.xaml?assembly=Perspex.Themes.Default"));

            result.Add(baseLight);

            return(result);
        }
Ejemplo n.º 17
0
        public void Binding_Should_Be_Assigned_To_Setter_Value_Instead_Of_Bound()
        {
            using (PerspexLocator.EnterScope())
            {
                PerspexLocator.CurrentMutable
                .Bind <IPclPlatformWrapper>()
                .ToConstant(Mock.Of <IPclPlatformWrapper>());

                var xaml   = "<Style xmlns='https://github.com/perspex'><Setter Value='{Binding}'/></Style>";
                var loader = new PerspexXamlLoader();
                var style  = (Style)loader.Load(xaml);
                var setter = (Setter)(style.Setters.First());

                Assert.IsType <Binding>(setter.Value);
            }
        }
Ejemplo n.º 18
0
        public void Binding_Should_Be_Assigned_To_ItemsSource_Instead_Of_Bound()
        {
            using (PerspexLocator.EnterScope())
            {
                PerspexLocator.CurrentMutable
                .Bind <IPclPlatformWrapper>()
                .ToConstant(Mock.Of <IPclPlatformWrapper>());

                var xaml      = "<DataTemplates xmlns='https://github.com/perspex'><TreeDataTemplate ItemsSource='{Binding}'/></DataTemplates>";
                var loader    = new PerspexXamlLoader();
                var templates = (DataTemplates)loader.Load(xaml);
                var template  = (TreeDataTemplate)(templates.First());

                Assert.IsType <Binding>(template.ItemsSource);
            }
        }
Ejemplo n.º 19
0
        public void Binding_Should_Be_Assigned_To_ItemsSource_Instead_Of_Bound()
        {
            using (PerspexLocator.EnterScope())
            {
                PerspexLocator.CurrentMutable
                    .Bind<IPclPlatformWrapper>()
                    .ToConstant(Mock.Of<IPclPlatformWrapper>());

                var xaml = "<DataTemplates xmlns='https://github.com/perspex'><TreeDataTemplate ItemsSource='{Binding}'/></DataTemplates>";
                var loader = new PerspexXamlLoader();
                var templates = (DataTemplates)loader.Load(xaml);
                var template = (TreeDataTemplate)(templates.First());

                Assert.IsType<Binding>(template.ItemsSource);
            }                
        }
Ejemplo n.º 20
0
        public void Named_Control_Is_Added_To_NameScope()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <Button Name='button'>Foo</Button>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var button = window.FindControl <Button>("button");

                Assert.Equal("Foo", button.Content);
            }
        }
Ejemplo n.º 21
0
        public void Binding_Should_Be_Assigned_To_Setter_Value_Instead_Of_Bound()
        {
            using (PerspexLocator.EnterScope())
            {
                PerspexLocator.CurrentMutable
                    .Bind<IPclPlatformWrapper>()
                    .ToConstant(Mock.Of<IPclPlatformWrapper>());

                var xaml = "<Style xmlns='https://github.com/perspex'><Setter Value='{Binding}'/></Style>";
                var loader = new PerspexXamlLoader();
                var style = (Style)loader.Load(xaml);
                var setter = (Setter)(style.Setters.First());

                Assert.IsType<Binding>(setter.Value);
            }                
        }
Ejemplo n.º 22
0
        public void Binding_To_Window_Works()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
        Title='{Binding Foo}'>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);

                window.DataContext = new { Foo = "foo" };
                window.ApplyTemplate();

                Assert.Equal("foo", window.Title);
            }
        }
Ejemplo n.º 23
0
        public void Binding_ProgressBar_Value_To_Invalid_Value_Uses_FallbackValue()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml        = @"
<Window xmlns='https://github.com/perspex'>
    <ProgressBar Maximum='10' Value='{Binding Value, FallbackValue=3}'/>
</Window>";
                var loader      = new PerspexXamlLoader();
                var window      = (Window)loader.Load(xaml);
                var progressBar = (ProgressBar)window.Content;

                window.DataContext = new { Value = "foo" };
                window.ApplyTemplate();

                Assert.Equal(3, progressBar.Value);
            }
        }
Ejemplo n.º 24
0
        public void Can_Set_DataContext_In_DataTemplate()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
        xmlns:local='clr-namespace:Perspex.Markup.Xaml.UnitTests;assembly=Perspex.Markup.Xaml.UnitTests'>
    <Window.DataTemplates>
        <DataTemplate DataType='{Type local:TestViewModel}'>
            <Canvas Name='foo' DataContext='{Binding Child}'/>
        </DataTemplate>
    </Window.DataTemplates>
    <ContentControl Name='target' Content='{Binding Child}'/>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var target = window.FindControl <ContentControl>("target");

                var viewModel = new TestViewModel
                {
                    String = "Root",
                    Child  = new TestViewModel
                    {
                        String = "Child",
                        Child  = new TestViewModel
                        {
                            String = "Grandchild",
                        }
                    },
                };

                window.DataContext = viewModel;

                window.ApplyTemplate();
                target.ApplyTemplate();
                ((ContentPresenter)target.Presenter).UpdateChild();

                var canvas = (Canvas)target.Presenter.Child;
                Assert.Same(viewModel, target.DataContext);
                Assert.Same(viewModel.Child.Child, canvas.DataContext);
            }
        }
Ejemplo n.º 25
0
        public void Binding_To_DataContext_Works()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
        xmlns:local='clr-namespace:Perspex.Markup.Xaml.UnitTests.Xaml;assembly=Perspex.Markup.Xaml.UnitTests'>
    <Button Name='button' Content='{Binding Foo}'/>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var button = window.FindControl <Button>("button");

                button.DataContext = new { Foo = "foo" };
                window.ApplyTemplate();

                Assert.Equal("foo", button.Content);
            }
        }
Ejemplo n.º 26
0
        public void StyleResource_Can_Be_Found_In_TopLevel_Styles()
        {
            var xaml = @"
<Styles xmlns='https://github.com/perspex'
        xmlns:mut='https://github.com/perspex/mutable'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <Style>
        <Style.Resources>
            <Color x:Key='color'>#ff506070</Color>
            <mut:SolidColorBrush x:Key='brush' Color='{StyleResource color}'/>
        </Style.Resources>
    </Style>
</Styles>";

            var loader = new PerspexXamlLoader();
            var styles = (Styles)loader.Load(xaml);
            var brush  = (Perspex.Media.Mutable.SolidColorBrush)styles.FindResource("brush");

            Assert.Equal(0xff506070, brush.Color.ToUint32());
        }
Ejemplo n.º 27
0
        public void Can_Bind_Control_To_Non_Control()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
        xmlns:local='clr-namespace:Perspex.Markup.Xaml.UnitTests.Xaml;assembly=Perspex.Markup.Xaml.UnitTests'>
    <Button Name='button' Content='Foo'>
        <Button.Tag>
            <local:NonControl Control='{Binding #button}'/>
        </Button.Tag>
    </Button>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var button = window.FindControl <Button>("button");

                Assert.Same(button, ((NonControl)button.Tag).Control);
            }
        }
Ejemplo n.º 28
0
        public App()
        {
            RegisterServices();
            InitializeSubsystems((int)Environment.OSVersion.Platform);
            Styles.Add(new DefaultTheme());

            var loader    = new PerspexXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Perspex.Themes.Default.Accents.BaseLight.xaml?assembly=Perspex.Themes.Default"));

            Styles.Add(baseLight);

            Styles.Add(new SampleTabStyle());
            DataTemplates = new DataTemplates
            {
                new FuncTreeDataTemplate <Node>(
                    x => new TextBlock {
                    Text = x.Name
                },
                    x => x.Children),
            };
        }
Ejemplo n.º 29
0
        public void Control_Is_Added_To_Parent_Before_Properties_Are_Set()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml    = @"
<Window xmlns='https://github.com/perspex'
             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
             xmlns:local='clr-namespace:Perspex.Markup.Xaml.UnitTests.Xaml;assembly=Perspex.Markup.Xaml.UnitTests'>
    <local:InitializationOrderTracker Width='100'/>
</Window>";
                var loader  = new PerspexXamlLoader();
                var window  = (Window)loader.Load(xaml);
                var tracker = (InitializationOrderTracker)window.Content;

                var attached     = tracker.Order.IndexOf("AttachedToLogicalTree");
                var widthChanged = tracker.Order.IndexOf("Property Width Changed");

                Assert.NotEqual(-1, attached);
                Assert.NotEqual(-1, widthChanged);
                Assert.True(attached < widthChanged);
            }
        }
Ejemplo n.º 30
0
        public void SolidColorBrush_Can_Be_Added_To_Style_Resources()
        {
            using (UnitTestApplication.Start(TestServices.MockPlatformWrapper))
            {
                var xaml        = @"
<UserControl xmlns='https://github.com/perspex'
             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <UserControl.Styles>
        <Style>
            <Style.Resources>
                <SolidColorBrush x:Key='brush'>#ff506070</SolidColorBrush>
            </Style.Resources>
        </Style>
    </UserControl.Styles>
</UserControl>";
                var loader      = new PerspexXamlLoader();
                var userControl = (UserControl)loader.Load(xaml);
                var brush       = (SolidColorBrush)((Style)userControl.Styles[0]).Resources["brush"];

                Assert.Equal(0xff506070, brush.Color.ToUint32());
            }
        }
Ejemplo n.º 31
0
        public void Can_Bind_To_DataContext_Of_Anchor_On_Non_Control()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml   = @"
<Window xmlns='https://github.com/perspex'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
        xmlns:local='clr-namespace:Perspex.Markup.Xaml.UnitTests.Xaml;assembly=Perspex.Markup.Xaml.UnitTests'>
    <Button Name='button'>
        <Button.Tag>
            <local:NonControl String='{Binding Foo}'/>
        </Button.Tag>
    </Button>
</Window>";
                var loader = new PerspexXamlLoader();
                var window = (Window)loader.Load(xaml);
                var button = window.FindControl <Button>("button");

                button.DataContext = new { Foo = "foo" };

                Assert.Equal("foo", ((NonControl)button.Tag).String);
            }
        }
Ejemplo n.º 32
0
        public void StyleResource_Can_Be_Found_Across_Xaml_Files()
        {
            using (UnitTestApplication.Start(TestServices.StyledWindow))
            {
                var xaml = @"
<Window xmlns='https://github.com/perspex'
        xmlns:mut='https://github.com/perspex/mutable'
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
    <Window.Styles>
        <StyleInclude Source='resm:Perspex.Markup.Xaml.UnitTests.Xaml.Style1.xaml?assembly=Perspex.Markup.Xaml.UnitTests'/>
        <StyleInclude Source='resm:Perspex.Markup.Xaml.UnitTests.Xaml.Style2.xaml?assembly=Perspex.Markup.Xaml.UnitTests'/>
    </Window.Styles>
    <Border Name='border' Background='{StyleResource RedBrush}'/>
</Window>";

                var loader      = new PerspexXamlLoader();
                var window      = (Window)loader.Load(xaml);
                var border      = window.FindControl <Border>("border");
                var borderBrush = (Perspex.Media.Mutable.SolidColorBrush)border.Background;

                Assert.NotNull(borderBrush);
                Assert.Equal(0xffff0000, borderBrush.Color.ToUint32());
            }
        }
Ejemplo n.º 33
0
        public void Invalid_FallbackValue_Logs_Error()
        {
            var called = false;

            LogCallback checkLogMessage = (level, area, src, mt, pv) =>
            {
                if (level == LogEventLevel.Error &&
                    area == LogArea.Binding &&
                    mt == "Error binding to {Target}.{Property}: {Message}" &&
                    pv.Length == 3 &&
                    pv[0] is ProgressBar &&
                    object.ReferenceEquals(pv[1], ProgressBar.ValueProperty) &&
                    (string)pv[2] == "Could not convert FallbackValue 'bar' to 'System.Double'")
                {
                    called = true;
                }
            };

            using (UnitTestApplication.Start(TestServices.StyledWindow))
                using (TestLogSink.Start(checkLogMessage))
                {
                    var xaml        = @"
<Window xmlns='https://github.com/perspex'>
    <ProgressBar Maximum='10' Value='{Binding Value, FallbackValue=bar}'/>
</Window>";
                    var loader      = new PerspexXamlLoader();
                    var window      = (Window)loader.Load(xaml);
                    var progressBar = (ProgressBar)window.Content;

                    window.DataContext = new { Value = "foo" };
                    window.ApplyTemplate();

                    Assert.Equal(0, progressBar.Value);
                    Assert.True(called);
                }
        }
Ejemplo n.º 34
0
 private void InitializeComponent()
 {
     PerspexXamlLoader.Load(this);
 }
Ejemplo n.º 35
0
        private void InitializeComponent()
        {
            var loader = new PerspexXamlLoader();

            loader.Load(typeof(XamlTestApp), this);
        }