Application Framework

github Tutorial Data


Although noesisGUI can be fully integrated within your application, as shown in the integration tutorial, an Application Framework is also provided. This framework is an Open Source library that provides abstractions to create multiplatform applications. The framework is a good example about how to use Noesis and it provides many helpers that can be useful. All our public samples use the application framework.

The extensions provided, like Application and Window, are compatible with WPF, so compatible with Microsoft Blend. Using the application framework you can design applications that will indistinctly run in a Windows window, macOS window, iPhone screen, or Xbox TV for example. The framework supports all the platforms where NoesisGUI is available.


The following is a list of the functionality exposed by the Application Framework:


Application Framework provides the functionality needed by our samples and tutorials. It should be never used as a 'Production Ready' library. Clients should take the code as a starting point that must be adapted and tweaked for each specific scenario.

Headers and Namespace

Headers for the application framework are contained within the NsApp and NsRender modules. The API is exposed in the NoesisApp namespace.

#include <NsApp/EntryPoint.h>
#include <NsApp/Application.h>
#include <NsApp/ApplicationLauncher.h>
#include <NsApp/Window.h>
#include <NsApp/EmbeddedXamlProvider.h>
#include <NsApp/EmbeddedFontProvider.h>

using namespace Noesis;
using namespace NoesisApp;


Note how framework headers are not inside standard NoesisGUI include folder neither part of 'NoesisPCH.h' precompiled header.

Entry Point

As main() is not available in all platforms, the framework provides a portable entry point, NsMain. You will normally create here a Launcher, configure it and Run() it.

int NsMain(int argc, char **argv)
    AppLauncher launcher;
    launcher.SetArguments(argc, argv);
    return launcher.Run();


The Launcher is the first instance you create. It is in charge of application initialization and main message loop. It also provides a few important overridable functions:

  • RegisterComponents: for registering classes in the component factory. Each extended class that need to be instantiated by XAML needs to be registered here as explained in the Extending NoesisGUI tutorial. For the framework you need to register at least the Application and Window class.
  • GetXamlProvider, GetFontProvider and GetTextureProvider: for customizing how resources are loaded. You can install custom handlers for XAMLs, font and textures as explained in the Customizing Resource Loading tutorial.
class AppLauncher final: public ApplicationLauncher
    void RegisterComponents() const override

    Ptr<XamlProvider> GetXamlProvider() const override
        EmbeddedXaml xamls[] =
            { "App.xaml", App_xaml },
            { "MainWindow.xaml", MainWindow_xaml }

        return *new EmbeddedXamlProvider(xamls);

    Ptr<FontProvider> GetFontProvider() const override
        EmbeddedFont fonts[] =
            { "", Roboto_Regular_ttf },
            { "", Roboto_Bold_ttf }

        return *new EmbeddedFontProvider(fonts);


The Embedded family of resource providers found in the framework allows you to embed resources in the executable. Each time you edit a resource contained in the project it is automatically converted to a header file using 'bin2h', an tool distributed with each sample. For example, 'Roboto-Regular.ttf.bin.h' is automatically regenerated each time 'Roboto-Regular.ttf' changes. The same for the rest of resources.


The Application class directly correspond to the WPF Application Class. Each application provides its own implementation inheriting from Application base class.

namespace RssReader
    class App final: public Application
        NS_IMPLEMENT_INLINE_REFLECTION_(App, Application, "RssReader.App")

The main purpose of the Application is providing a global resource dictionary and setting the main window, the StartupUri.


      <ResourceDictionary Source="Theme/NoesisTheme.DarkBlue.xaml"/>
    <SolidColorBrush x:Key="Background0" Color="#FF2F3F4F"/>
    <SolidColorBrush x:Key="Background1" Color="SlateGray"/>
    <SolidColorBrush x:Key="Foreground0" Color="White"/>
    <SolidColorBrush x:Key="Foreground1" Color="SkyBlue"/>
    <SolidColorBrush x:Key="Foreground2" Color="Black"/>
    <SolidColorBrush x:Key="Border0" Color="LightSlateGray"/>



The Window class mimics the WPF Window Class. It is a container that shows its content inside an operating system window. Public properties like Title, ResizeMode, WindowStyle, Width and Height control the aspect of the native window.

   Title="NoesisGUI - RSS Reader" Width="487" Height="630" ResizeMode="NoResize"
   Background="{StaticResource Background0}"
   Foreground="{StaticResource Foreground0}"
   FontFamily="{StaticResource DefaultFont}"

    <DockPanel Background="{StaticResource Background0}" LastChildFill="True"
               KeyboardNavigation.DirectionalNavigation="Contained" Width="325" Height="420">
      <TextBlock DockPanel.Dock="Top" Text="RSS Reader" FontSize="32" FontWeight="Bold"
                 TextAlignment="Center" Margin="0,10,0,0"/>
      <Border DockPanel.Dock="Top" Background="{StaticResource Background1}"
              BorderBrush="{StaticResource Border}" BorderThickness="1" CornerRadius="2"
              Margin="10" Padding="15,5">
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
          <TextBlock Grid.Column="0" Text="URL: " VerticalAlignment="Center"/>
          <TextBox x:Name="Address" Grid.Column="1" Text=""/>
          <Button x:Name="GoTo" Grid.Column="2" Content="Go" Click="OnGoToClicked" Margin="2,0,0,0"/>
      <Grid DockPanel.Dock="Bottom" Margin="10">
          <Style TargetType="Button">
            <Setter Property="BorderBrush" Value="{StaticResource Background1}"/>
        <Button x:Name="Prev" Grid.Column="0" Content="Prev" Click="OnPrevClicked"/>
        <Button x:Name="Next" Grid.Column="1" Content="Next" Click="OnNextClicked"/>
      <Border Background="{StaticResource Background1}" BorderBrush="{StaticResource Border}"
              BorderThickness="1" CornerRadius="2" Margin="10,0" Padding="5">
        <Grid x:Name="ContentPanel" Margin="10,0">
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
          <TextBlock x:Name="EntryTitle" Grid.Row="0" FontSize="20" FontWeight="Bold"
                     Foreground="{StaticResource Foreground1}" TextAlignment="Center" Margin="0,5,0,5"/>
          <ScrollViewer Grid.Row="1"  Margin="0,10" Focusable="False"
                        HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
            <TextBlock x:Name="EntryDesc" TextWrapping="Wrap" Margin="10,0"
                       Foreground="{StaticResource Foreground2}" FontSize="14"/>


Window base class is normally extended to implement code-behind functionality.

namespace RssReader
    class MainWindow final: public Window
        MainWindow(): _index(0)

            _title = FindName<TextBlock>("EntryTitle");

            _desc = FindName<TextBlock>("EntryDesc");

        void InitializeComponent()
            Noesis::GUI::LoadComponent(this, "MainWindow.xaml");

        bool ConnectEvent(BaseComponent* source, const char* event, const char* handler) override
            NS_CONNECT_EVENT(Button, Click, OnGoToClicked);
            NS_CONNECT_EVENT(Button, Click, OnPrevClicked);
            NS_CONNECT_EVENT(Button, Click, OnNextClicked);
            return false;

        void OnGoToClicked(BaseComponent* /*sender*/, const RoutedEventArgs& /*e*/)

        void OnPrevClicked(BaseComponent* /*sender*/, const RoutedEventArgs& /*e*/)
            _index = _index == 0 ? 2 : _index - 1;

        void OnNextClicked(BaseComponent* /*sender*/, const RoutedEventArgs& /*e*/)
            _index = _index == 2 ? 0 : _index + 1;

        int _index;
        TextBlock* _title;
        TextBlock* _desc;


Noesis Theme

Included in the framework, there is a rich-featured theme with support for Accent colors and Dark and Light modes. To use it, just add our Noesis.GUI.Extensions NuGet package to the Blend project and reference the theme in the application resources.

Dark Modes Light Modes
NoesisTheme.DarkRed.xaml NoesisTheme.LightRed.xaml
NoesisTheme.DarkGreen.xaml NoesisTheme.LightGreen.xaml
NoesisTheme.DarkBlue.xaml NoesisTheme.LightBlue.xaml
NoesisTheme.DarkOrange.xaml NoesisTheme.LightOrange.xaml
NoesisTheme.DarkEmerald.xaml NoesisTheme.LightEmerald.xaml
NoesisTheme.DarkPurple.xaml NoesisTheme.LightPurple.xaml
NoesisTheme.DarkCrimson.xaml NoesisTheme.LightCrimson.xaml
NoesisTheme.DarkLime.xaml NoesisTheme.LightLime.xaml
NoesisTheme.DarkAqua.xaml NoesisTheme.LightAqua.xaml
    <ResourceDictionary Source="pack://application:,,,/Noesis.GUI.Extensions;component/Theme/NoesisTheme.DarkBlue.xaml" />

Command Line Switches

The following command line switches are supported by all applications created with the Application Framework:

  • --render [D3D11|GL|Metal|...]: overrides the default renderer.
  • --vsync [0|1]: disables vertical synchronization.
  • --samples N: enables multisample anti-aliasing (MSAA), by default it is off.
  • --ppaa [0|1]: enables cheap antialiasing anti-aliasing (enabled by default).
  • --linear: for switching to linear rendering, by default rendering happens in gamma space.
  • --lcd [0|1]: enables subpixel rendering compatible with LCD displays.
  • --log_binding: to increase the verbosity of logging when using data binding.
  • --emulate_touch: enables emulation of touch input from mouse events.

Shortcut Keys

The following shortcuts enable debugging functionality to inspect the performance of your application:

  • CTRL + T: display the debug toolbar.
  • CTRL + W: toggles wireframe mode when rendering triangles.
  • CTRL + B: each batch submitted to the GPU is given a unique solid color.
  • CTRL + O: display pixel overdraw using blending layers. Different colors are used for each type of triangle: green for normal, red for opacities and blue for clipping masks.
  • CTRL + P: per-primitive Antialiasing extrudes the contours of the geometry and smooths them. Useful when GPU multisampling is not enabled.
  • CTRL + F: display a performance stats panel.
© 2017 Noesis Technologies