Convert Figma logo to code with AI

microsoft logoWinUI-Gallery

This app demonstrates the controls available in WinUI and the Fluent Design System.

2,997
666
2,997
88

Top Related Projects

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.

This app demonstrates the controls available in WinUI and the Fluent Design System.

API samples for the Universal Windows Platform.

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.

Quick Overview

The WinUI-Gallery is a Microsoft repository showcasing the Windows UI Library (WinUI) controls and features. It serves as a comprehensive demonstration and reference for developers building Windows applications using the WinUI framework, providing interactive examples and sample code for various UI components and functionalities.

Pros

  • Extensive collection of WinUI controls and features demonstrated in a single application
  • Interactive examples allow developers to see and test controls in real-time
  • Includes sample code for each control, making it easy to implement in your own projects
  • Regularly updated to reflect the latest WinUI releases and best practices

Cons

  • Primarily focused on WinUI, may not be as useful for developers using other UI frameworks
  • Some examples may be overly simplistic and not cover all real-world use cases
  • Large repository size due to the comprehensive nature of the gallery
  • Requires Windows 10 or later to run, limiting accessibility for developers on other platforms

Code Examples

Here are a few short code examples from the WinUI-Gallery:

  1. Creating a basic button:
<Button x:Name="MyButton" Click="MyButton_Click">Click me!</Button>
  1. Implementing a ProgressRing control:
<ProgressRing IsActive="True" 
              Width="50" 
              Height="50"
              Foreground="Blue"/>
  1. Using a NavigationView control:
<NavigationView x:Name="NavView"
                ItemInvoked="NavView_ItemInvoked"
                Loaded="NavView_Loaded"
                PaneDisplayMode="Top">
    <NavigationView.MenuItems>
        <NavigationViewItem Content="Home" Tag="home"/>
        <NavigationViewItem Content="Account" Tag="account"/>
        <NavigationViewItem Content="Settings" Tag="settings"/>
    </NavigationView.MenuItems>
</NavigationView>

Getting Started

To get started with the WinUI-Gallery:

  1. Clone the repository:

    git clone https://github.com/microsoft/WinUI-Gallery.git
    
  2. Open the solution file WinUIGallery.sln in Visual Studio 2019 or later.

  3. Set the startup project to WinUIGallery.Desktop or WinUIGallery.DesktopWap.

  4. Build and run the project to explore the gallery.

For more detailed instructions and requirements, refer to the repository's README file.

Competitor Comparisons

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.

Pros of microsoft-ui-xaml

  • More comprehensive UI framework with a wider range of controls and features
  • Actively maintained and updated with new Windows features and APIs
  • Provides deeper integration with Windows platform capabilities

Cons of microsoft-ui-xaml

  • Larger codebase and potentially steeper learning curve
  • May include more components than needed for simpler applications
  • Requires more frequent updates to stay current with Windows releases

Code Comparison

WinUI-Gallery (App.xaml.cs):

protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
    m_window = new MainWindow();
    m_window.Activate();
}

microsoft-ui-xaml (XamlControlsXamlHost.cpp):

void XamlControlsXamlHost::OnLaunched(LaunchActivatedEventArgs const& e)
{
    Frame rootFrame{ nullptr };
    auto content = Window::Current().Content();
    if (content)
    {
        rootFrame = content.try_as<Frame>();
    }
}

The WinUI-Gallery repository serves as a showcase and sample app for WinUI controls, while microsoft-ui-xaml is the core framework repository. WinUI-Gallery is more focused on demonstrating usage and providing examples, making it easier for developers to understand and implement WinUI controls. microsoft-ui-xaml, on the other hand, contains the actual implementation of the controls and offers more flexibility for advanced scenarios and customization.

This app demonstrates the controls available in WinUI and the Fluent Design System.

Pros of WinUI-Gallery

  • Comprehensive showcase of WinUI controls and features
  • Regularly updated with new samples and improvements
  • Serves as a valuable learning resource for developers

Cons of WinUI-Gallery

  • May have a steeper learning curve for beginners
  • Could benefit from more detailed documentation for complex samples

Code Comparison

WinUI-Gallery:

<Page
    x:Class="AppUIBasics.ControlPages.ButtonPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppUIBasics.ControlPages"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

Both repositories are identical, as they are the same project. The WinUI-Gallery repository serves as a comprehensive showcase for WinUI controls and features, providing developers with a valuable resource for learning and exploring the capabilities of the Windows UI Library. The repository is regularly updated with new samples and improvements, making it an excellent reference for staying up-to-date with WinUI development.

However, the complexity of some samples may present a steeper learning curve for beginners. Additionally, while the repository offers a wide range of examples, it could benefit from more detailed documentation for some of the more complex samples to further enhance its educational value.

API samples for the Universal Windows Platform.

Pros of Windows-universal-samples

  • Covers a broader range of Windows development topics, including system APIs and hardware integration
  • Provides examples for both UWP and Win32 app development
  • Includes samples for various Windows versions, offering backward compatibility insights

Cons of Windows-universal-samples

  • Less focused on modern UI development compared to WinUI-Gallery
  • May contain outdated samples for older Windows versions
  • Larger repository size, potentially making it harder to navigate and find specific examples

Code Comparison

Windows-universal-samples:

StorageFile file = await StorageFile.GetFileFromPathAsync(filename);
var stream = await file.OpenAsync(FileAccessMode.Read);
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);

WinUI-Gallery:

var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/SampleMedia/rainier.jpg"));
using var randomAccessStream = await file.OpenAsync(FileAccessMode.Read);
var bitmapImage = new BitmapImage();
await bitmapImage.SetSourceAsync(randomAccessStream);

The code snippets show that Windows-universal-samples tends to focus on lower-level APIs, while WinUI-Gallery emphasizes WinUI-specific components and modern Windows app development practices.

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.

Pros of WindowsAppSDK

  • More comprehensive framework for building Windows apps
  • Supports a wider range of Windows versions and device types
  • Provides a unified set of APIs and tools for modern Windows development

Cons of WindowsAppSDK

  • Steeper learning curve due to its broader scope
  • May include unnecessary components for simpler projects
  • Still in active development, potentially leading to more frequent changes

Code Comparison

WinUI-Gallery (XAML):

<Page
    x:Class="AppUIBasics.ControlPages.ButtonPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppUIBasics.ControlPages">

    <StackPanel>
        <Button Content="Standard Button" Click="Standard_Button_Click"/>
    </StackPanel>
</Page>

WindowsAppSDK (C#):

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

public sealed partial class MainWindow : Window
{
    public MainWindow()
    {
        this.InitializeComponent();
        Button myButton = new Button() { Content = "Click me" };
        myButton.Click += MyButton_Click;
        this.Content = myButton;
    }
}

Summary

While WinUI-Gallery focuses on showcasing UI controls and design patterns, WindowsAppSDK provides a more extensive framework for Windows app development. WindowsAppSDK offers greater flexibility and broader platform support but may be more complex for simple projects. WinUI-Gallery is ideal for exploring and learning about specific UI components, while WindowsAppSDK is better suited for building full-featured Windows applications.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

WinUI Gallery hero image

WinUI 3 Gallery

Build Status PRs Welcome GitHub license

Accompanying Sample App for WinAppSDK

This app demonstrates all of the WinUI 3 controls and styles available to make a modern Windows app with the Windows App SDK. It is the interactive companion to the Fluent Design Guidelines and shows the usage of the WinUI APIs.

WinUI 3 Gallery

Store badge

⭐ Features

  • WinUI controls samples: each control page shows the markup and codebehind used to create each example.

  • Use the Microsoft.UI.Xaml (WinUI) library: the app includes the latest WinUI NuGet package and shows how to use the WinUI controls like NavigationView, SwipeControl, and more.

  • Adaptive UI: in addition to showing how each control responds to different form factors, the app itself is responsive and shows various methods for achieving adaptive UI.

  • Design & accessibility guidance: design and accessibility pages help make the gallery a useful developer companion app.

👏 Contribute to WinUI Gallery

Any samples or docs improvements you'd like to see? We're always looking for a helping hand. Feel free to file an issue to start the discussion, or even better, create a PR with the change you'd like to see!

Check out these help wanted issues if you don't know where to start.

You can also learn more about current happenings with WinUI Gallery in the project board.

🚀 Getting started

Quick start guide to building the WinUI 3 Gallery:

1. Set up the environment

[!NOTE] The WinUI Gallery requires Visual Studio 2022 or later to build and Windows 10 or later to execute. If you're building an app with WinUI and Windows App SDK for the first time, follow these installation instructions.

Required Visual Studio components:

  • Windows application development

2. Clone the Repository

git clone https://github.com/microsoft/WinUI-Gallery.git

3. Open WinUIGallery.sln with Visual Studio and build!

Ensure that the WinUIGallery project is set as the startup project in Visual Studio.

➡️ Further information

To learn more about Windows app development, go to the Windows Dev Center.

Related topics

🏆 Contributors

Thanks to our amazing contributors!

WinUI 3 Gallery Contributors

Made with contrib.rocks.