Skip to content

Commit 8163fa3

Browse files
authored
First set of samples for MVP summit (#19)
1 parent 306f14c commit 8163fa3

185 files changed

Lines changed: 14595 additions & 9 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
*.cpp -text crlf diff
6+
7+
###############################################################################
8+
# Set default behavior for command prompt diff.
9+
#
10+
# This is need for earlier builds of msysgit that does not have it on by
11+
# default for csharp files.
12+
# Note: This is only used by command line.
13+
###############################################################################
14+
#*.cs diff=csharp
15+
16+
###############################################################################
17+
# Set the merge driver for project and solution files.
18+
#
19+
# Merging from the command prompt will add diff markers to the files if there
20+
# are conflicts (Merging from VS is not affected by the settings below, in VS
21+
# the diff markers are never inserted). Diff markers may cause the following
22+
# file extensions to fail to load in VS. An alternative would be to treat
23+
# these files as binary and thus will always conflict and require user
24+
# intervention with every merge. To do so, just uncomment the entries below.
25+
###############################################################################
26+
#*.sln merge=binary
27+
#*.csproj merge=binary
28+
#*.vbproj merge=binary
29+
#*.vcxproj merge=binary
30+
#*.vcproj merge=binary
31+
#*.dbproj merge=binary
32+
#*.fsproj merge=binary
33+
#*.lsproj merge=binary
34+
#*.wixproj merge=binary
35+
#*.modelproj merge=binary
36+
#*.sqlproj merge=binary
37+
#*.wwaproj merge=binary
38+
39+
###############################################################################
40+
# Behavior for image files.
41+
#
42+
# Image files are treated as binary by default.
43+
###############################################################################
44+
#*.jpg binary
45+
#*.png binary
46+
#*.gif binary
47+
48+
###############################################################################
49+
# Diff behavior for common document formats.
50+
#
51+
# Convert binary document formats to text before diffing them. This feature
52+
# is only available from the command line. Turn it on by uncommenting the
53+
# entries below.
54+
###############################################################################
55+
#*.doc diff=astextplain
56+
#*.DOC diff=astextplain
57+
#*.docx diff=astextplain
58+
#*.DOCX diff=astextplain
59+
#*.dot diff=astextplain
60+
#*.DOT diff=astextplain
61+
#*.pdf diff=astextplain
62+
#*.PDF diff=astextplain
63+
#*.rtf diff=astextplain
64+
#*.RTF diff=astextplain

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,4 @@ ASALocalRun/
328328

329329
# MFractors (Xamarin productivity tool) working folder
330330
.mfractor/
331+
/cpp/VirtualSurfaces/enc_temp_folder

CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in
5+
# the repo. Unless a later match takes precedence,
6+
# folks in the below list will be requested for
7+
# review when someone opens a pull request.
8+
* @windows-ui, @KarlErickson, @jwmsft, @bmitchell287, @JoshuaPartlow

README.md

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,71 @@
1+
# Visual layer samples for desktop applications
12

2-
# Contributing
3+
This repository contains samples that demonstrate the use of Window.UI.Composition APIs in WPF, Windows Forms, and C++ Win32 applications.
34

4-
This project welcomes contributions and suggestions. Most contributions require you to agree to a
5-
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
6-
the rights to use your contribution. For details, visit https://cla.microsoft.com.
5+
The Visual layer provides a high performance, retained-mode API for graphics, effects, and animations. It's the foundation for UI across Windows 10 devices. UWP XAML controls are built on the Visual layer, and it enables many aspects of the [Fluent Design System](../design/fluent-design-system/index.md), such as Light, Depth, Motion, Material, and Scale.
76

8-
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
9-
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
10-
provided by the bot. You will only need to do this once across all repos using our CLA.
7+
You can now use UWP APIs in non-UWP desktop applications to enhance the look, feel, and functionality of your WPF, Windows Forms, and C++ Win32 applications, and take advantage of the latest Windows 10 UI features that are only available via UWP.
8+
9+
## Create a visually engaging user interface in any Windows app
10+
11+
The Visual layer lets you create engaging experiences by using lightweight compositing of custom drawn content (visuals) and applying powerful animations, effects, and manipulations on those objects in your application. The Visual layer doesn't replace any existing UI framework; instead, it's a valuable supplement to those frameworks.
12+
13+
You can use the Visual layer to give your application a unique look and feel, and establish an identity that sets it apart from other applications. It also enables Fluent Design principles, which are designed to make your applications easier to use, drawing more engagement from users. For example, you can use it to create visual cues and animated screen transitions that show relationships among items on the screen.
14+
15+
For related documentation, see [Modernize your desktop app using the Visual layer](https://docs.microsoft.com/windows/uwp/composition/visual-layer-in-desktop-apps)
16+
17+
## Prepare your environment
18+
19+
Minimum requirements for using the Visual layer in desktop apps are listed here. Individual samples might have different requirements, which are listed in the readme for the sample.
20+
21+
- Visual Studio 2017 - [Get a free copy of Visual Studio 2017 with support for building Universal Windows apps](http://go.microsoft.com/fwlink/?LinkID=280676)
22+
- .NET Framework 4.7.2 or later
23+
- Windows 10 version 1803 or later
24+
- Windows 10 SDK 17134 or later
25+
26+
## Samples
27+
28+
### C++ Win32
29+
30+
| Sample | |
31+
| - | - |
32+
| [**Hello Composition sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/HelloComposition)</br>Demonstrates how to set up a project to use Composition APIs in a C++ Win32 app.</br>See the [Using the Visual layer with Win32](https://docs.microsoft.com/windows/uwp/composition/using-the-visual-layer-with-win32) tutorial for more info. | ![Hello Composition sample](images/hello-comp-win32.png) |
33+
| [**Hello Vectors sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/HelloVectors)</br>Demonstrates how to use vectors in the Visual layer. | ![Vector graphics UI](images/hello-vectors-win32.png) |
34+
| [**Virtual Surfaces sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/VirtualSurfaces)</br>Demonstrates how to use virtual surfaces in the Visual layer. | ![Virtual surfaces UI](images/virtual-surfaces-win32.png) |
35+
| [**Screen Capture sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/ScreenCaptureforHWND)</br>Demonstrates how to use screen capture APIs. | ![Screen capture UI](images/screen-capture-win32.png) |
36+
37+
### Windows Forms
38+
39+
| Sample | |
40+
| - | - |
41+
| [**Hello Composition sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/dotnet/WinForms/HelloComposition)</br>Demonstrates how to set up a project to use Composition APIs in a Windows Forms app.</br>See the [Using the Visual layer with Windows Forms](https://docs.microsoft.com/windows/uwp/composition/using-the-visual-layer-with-windows-forms) tutorial for more info. | ![Hello Composition sample](images/hello-comp-wf.png) |
42+
| [**Visual Layer Integration sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/dotnet/WinForms/VisualLayerIntegration)</br>Demonstrates how to use a bar graph created with Composition APIs in a Windows Forms app. | ![Bar graph UI](images/bar-graph-winforms.png) |
43+
44+
### WPF
45+
46+
| Sample | |
47+
| - | - |
48+
| [**Hello Composition sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/dotnet/WPF/HelloComposition)</br>Demonstrates how to set up a project to use Composition APIs in a WPF app.</br>See the [Using the Visual layer with WPF](https://docs.microsoft.com/windows/uwp/composition/using-the-visual-layer-with-wpf) tutorial for more info. | ![Hello Composition sample](images/hello-comp-wpf.png) |
49+
| [**Visual Layer Integration sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/dotnet/WPF/VisualLayerIntegration)</br>Demonstrates how to use a bar graph created with Composition APIs in a WPF app. | ![Bar graph UI](images/bar-graph-wpf.png) |
50+
| [**Screen Capture sample**](https://github.com/Microsoft/Windows.UI.Composition-Win32-Samples/tree/master/dotnet/WPF/ScreenCapture)</br>Demonstrates how to use screen capture APIs. | ![Screen capture UI](images/capture-wpf.png) |
51+
52+
## Limitations
53+
54+
While many Visual Layer features work the same when hosted in a desktop application as they do in a UWP app, some features do have limitations. Here are some of the limitations to be aware of:
55+
56+
- Effect chains rely on [Win2D](http://microsoft.github.io/Win2D/html/Introduction.htm) for the effect descriptions. The [Win2D NuGet package](https://www.nuget.org/packages/Win2D.uwp) is not supported in desktop applications, so you would need to recompile it from the [source code](https://github.com/Microsoft/Win2D).
57+
- To do hit testing, you need to do bounds calculations by walking the visual tree yourself. This is the same as the Visual Layer in UWP, except in this case there's no XAML element you can easily bind to for hit testing.
58+
- The Visual Layer does not have a primitive for rendering text.
59+
- When two different UI technologies are used together, such as WPF and the Visual Layer, they are each responsible for drawing their own pixels on the screen, and they can't share pixels. As a result, Visual Layer content is always rendered on top of other UI content. (This is known as the _airspace_ issue.) You might need to do extra coding and testing to ensure your Visual layer content resizes with the host UI and doesn't occlude other content.
60+
- Content hosted in a desktop application doesn't automatically resize or scale for DPI. Extra steps might required to ensure your content handles DPI changes. (See the platform specific tutorials for more info.)
61+
62+
## Contributing
63+
64+
While we expect to at a later date, this project is not currently accepting contributions. For now, if you have any feedback or questions, please open an Issue on GitHub for the team.
1165

1266
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
13-
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
14-
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
67+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
68+
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments
69+
70+
Copyright &copy; Microsoft Corporation. All rights reserved.
71+
This program/project is and its use is subject to the [MIT License](LICENSE)

0 commit comments

Comments
 (0)