Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing Windows apps for Windows 8.1, Windows Phone 8.1 and Windows 10. It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.

Subscribe to updates I use Win2D

Statistics on Win2D

Number of watchers on Github 1023
Number of open issues 42
Average time to close an issue 8 days
Main language C++
Average time to merge a PR 1 day
Open pull requests 2+
Closed pull requests 10+
Last commit almost 3 years ago
Repo Created almost 6 years ago
Repo Last Updated about 2 years ago
Size 40.9 MB
Homepage http://microsoft....
Organization / Authormicrosoft
Page Updated
Do you use Win2D? Leave a review!
View open issues (42)
View Win2D activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating Win2D for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing Windows apps for Windows 8.1, Windows Phone 8.1 and Windows 10. It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.

Where to get it
How to use it
More info

Code Example

To give you a flavor of what the code looks like, here is a snippet of XAML:


    <canvas:CanvasControl Draw="canvasControl_Draw" ClearColor="CornflowerBlue" />

and C#:

void canvasControl_Draw(CanvasControl sender, CanvasDrawEventArgs args)
    args.DrawingSession.DrawEllipse(155, 115, 80, 30, Colors.Black, 3);
    args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow);

or C++/CX:

void MainPage::CanvasControl_Draw(CanvasControl^ sender, CanvasDrawEventArgs^ args)
    args->DrawingSession->DrawEllipse(155, 115, 80, 30, Colors::Black, 3);
    args->DrawingSession->DrawText("Hello, world!", 100, 100, Colors::Yellow);

or VB:

Sub canvasControl_Draw(sender As CanvasControl, args As CanvasDrawEventArgs)
    args.DrawingSession.DrawEllipse(155, 115, 80, 30, Colors.Black, 3)
    args.DrawingSession.DrawText("Hello, world!", 100, 100, Colors.Yellow)
End Sub

Using Win2D

The documentation explains how to install Visual Studio, add the Win2D NuGet package to your project, and get started using the API.

Building Win2D from source

  • Recommended: Visual Studio 2017 with Visual Studio Tools for Universal Windows Apps 15.0.26430.06
  • Visual Studio 2013 Update 5 is also supported (for Windows 8.1 or Windows Phone 8.1 development only)
Clone Repository
  • Go to 'View' -> 'Team Explorer' -> 'Local Git Repositories' -> 'Clone'
  • Add the Win2D repository URL (https://github.com/Microsoft/Win2D.git) and hit 'Clone'
Build NuGet Packages
  • If using Visual Studio 2017:
    • Launch 'Developer Command Prompt for VS2017'
  • If using Visual Studio 2013:
    • In Windows search, type 'Visual Studio Tools', and select that folder to open it
    • Launch 'Developer Command Prompt for VS2013'
  • Change directory to your cloned Win2D repository and run 'build'
Point Visual Studio at the resulting 'bin' directory
  • In Visual Studio, go to 'Tools' -> 'NuGet Package Manager' -> 'Package Manager Settings'
  • Choose 'Package Sources'
  • Click the '+' button to add a new source
  • Set 'Name' to 'Win2D' (or a name of your choosing)
  • Set 'Source' to the full path to the 'bin' directory (inside your cloned Win2D repository)
  • Click the 'Update' button
  • Click 'OK'

Locally built versions of Win2D are marked as prerelease, so you must change the 'Stable Only' setting to 'Include Prerelease' when adding them to your project.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Win2D open issues Ask a question     (View All Issues)
  • over 3 years Garbage collector impact on smooth animation
  • over 3 years Cannot create instance of type 'Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl'
  • over 3 years Question: Win2D on Raspberry Pi performance
  • over 3 years The presence of old Visual C++ distributables makes Win2D act unreliably
  • over 3 years Invalidate on HighContrastChanged
  • over 3 years MediaCapture with GPU based IBasicVideoEffect issue still there
  • over 3 years dxcap -forcetdr can crash CanvasAnimatedControl due to DXGI_ERROR_WAS_STILL_DRAWING
  • over 3 years ExampleGallery Ink demo crashes when you "clear" then "save"
  • over 3 years CanvasComposition.CreateDrawingSession should allow specifying DPI
  • almost 4 years Wrong rendering if sprite batches are used back-to-back (OS bug)
  • almost 4 years Performance optimization best practices?
  • about 4 years Need more text samples
  • about 4 years TDR after resuming app on Surface 3 (graphics driver bug)
  • about 4 years WINMDEXP : error WME1007: Could not resolve reference 'Assembly(Name=Windows.Foundation.FoundationContract (Visual Studio bug)
  • over 4 years Win2D and SharpDX interop in C#
  • over 4 years sample showing how to incorporate scenegraph
  • over 4 years Expose IDWriteGlyphRunAnalysis (getting a SW alpha texture for a glyph run)
  • over 4 years Expose IDWriteTextLayout3::InvalidateLayout
  • over 4 years Expose color fonts
  • over 4 years Expose IDWriteFontFace1::GetDesignGlyphAdvances
  • over 4 years Expose IDWriteFactory1::GetEudcFontCollection
  • over 4 years Expose all the options in IDWriteFactory::CreateCustomRenderingParams
  • over 4 years Expose IDWriteFontFileStream (load fonts from a stream, not just a URI)
  • over 4 years Make an OpenType tag from a string of four characters (to pass to typography APIs)
  • over 4 years Expose pair kerning options
  • over 4 years Expose font file accessors
  • over 4 years Enable font streaming
  • over 4 years Expose glyph design metrics (converted to em space)
  • over 4 years Support custom (non-system) font fallbacks
  • over 4 years Expose IDWriteFontSetBuilder
Win2D open pull requests (View All Pulls)
  • Ensure CanvasVirtualControl gets initialized on CoreWindow.WindowVisibilityChanged event.
  • Win2D geometry interop with RS4 Windows.UI.Composition.CompositionPath
Win2D questions on Stackoverflow (View All Questions)
  • How to use vertex shader via Win2d
  • Prevent Win2D Animated Canvas from clearing
  • Win2d blur doesn't always work in c++
  • Win2D CanvasBitmap vs Microsoft.UI.Composition CompositionImage
  • Vector2 types in Win2D drawing method inconsistency
  • Memory issue with win2D in winrt app
  • How to create a blurred background dialog box using Win2D?
  • how to get a drawingsession from a canvascontrol (win2d)
  • VB.Net make a image in background task using Win2d
  • How to trim text in Win2D using geometry
  • How to apply Win2D Blur effect to a picture from gallery?
  • How to calculate the size of a piece of text in Win2D
  • How to get the width and height of a Win2D CanvasBitmap during CreateResources?
Win2D list of languages used
Other projects in C++