Windows.Graphics Reference

Overview

The Windows.Graphics namespace provides a set of APIs for 2D graphics rendering, image manipulation, and drawing primitives in Windows applications. These APIs are optimized for performance and integrate tightly with the Windows UI stack.

Key Types

Sample: Draw a Gradient Rectangle

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;
using Windows.UI;

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        InitializeComponent();

        var rect = new Rectangle
        {
            Width = 200,
            Height = 150,
            Fill = new LinearGradientBrush(
                new GradientStopCollection
                {
                    new GradientStop { Color = Colors.CornflowerBlue, Offset = 0.0 },
                    new GradientStop { Color = Colors.MediumSeaGreen, Offset = 1.0 }
                },
                0)
        };

        Content = new Grid { Children = { rect } };
    }
}

Related Topics