Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User/kegu/wincompsamples #222

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 23 additions & 0 deletions Samples/Composition/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "Composition Samples"
page_type: sample
languages:
- csharp
products:
- windows
- windows-app-sdk
urlFragment: rendering
description: "Demonstrate the usage of rendering APIs (in both Microsoft.UI.Composition and Windows.UI.Composition) with WinAppSDK apps."
extendedZipContent:
- path: LICENSE
target: LICENSE
---

# Composition Samples
Welcome to the Windows Composition Samples. These samples demonstrate the usage of both Microsoft.UI.Composition and Windows.UI.Composition APIs that you can use to enhance your Windows App SDK application.

## Dynamic Refresh Rate Sample

## Sample Gallery
This is the place for the latest code samples, demos, and developer feedback around building beautiful and engaging WinUI3 apps. This repo focuses on the platform building blocks that make up the [Fluent Design System](https://fluent.microsoft.com/), with emphasis on creating UI using APIs in the [Microsoft.UI.Composition](https://docs.microsoft.com/windows/winui/api/microsoft.ui.composition) and [Microsoft.UI.Input](https://docs.microsoft.com/windows/winui/api/microsoft.ui.input) namespaces. For those of you familiar with the Universal Windows Platform Composition Samples, these samples are very similar but instead built on the APIs in the WinAppSDK (to learn more about the WinAppSDK, visit [here](https://docs.microsoft.com/windows/apps/windows-app-sdk/)).

76 changes: 76 additions & 0 deletions Samples/Composition/SampleGallery/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributing

The Windows Composition Samples repo is built on open source principles. We welcome and encourage community contributions to help improve the codebase, samples, and overall quality of this project. In order to contribute, please follow the guidelines below. Thank you for your interest in the Windows.UI.Composition Samples project!

## Prerequisite - CLA

Microsoft asks that all contributors sign a contributor license agreement (CLA).
CLAs are generally common and accepted in most open source software projects.
We all want Microsoft's open source projects to be as widely used and
distributed as possible. We also want its users to be confident about the
origins and continuing existence of the code. The CLA helps us achieve that
goal by ensuring that we have the agreement of our contributors to use their
work, whether it be code, or documentation.

The CLA permits Microsoft to distribute your code and submissions without
restriction. It doesn't require you to assign to us any copyright you have,
the ownership of the copyright remains with you. You cannot withdraw
permission for use of the contribution at a later date.

We are generally seeking originally authored code, submissions and documentation
as contributions. Should you wish to submit materials that are not your original
work, you may submit them separately to the Project in accordance with the terms
of the CLA.

Our Azure Pull Request Bot will automatically check for a signed CLA when you
submit a pull request. If there isn't a CLA on file, it will walk you through an all electronic process. **Note**: your employer may also have to complete an on-line form.

## Source Directory Structure

Since Windows.UI.Composition is constantly being updated, this project’s directory structure facilitates access to samples that will run on a variety of SDK versions. Each directory is numbered for the SDK version of the samples it contains. If you are unsure which SDK version you are using, you can create a new blank C# project and check the SDK version in its manifest.

## Contribute - Pull Requests

Create a pull request in order to submit new samples or fixes. All pull requests should follow the general guidelines below in addition to the guidelines specific to the type of pull request.

### Pull Request Work Flow

#### Creating a Branch

In order to begin making changes for a pull request, first start by creating a new working branch. This can be done either in [Visual Studio](https://docs.microsoft.com/en-us/vsts/git/tutorial/branches?tabs=visual-studio), [via commandline](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging), or in other tools like the [GitHub Desktop app](https://help.github.com/desktop/guides/contributing-to-projects/creating-a-branch-for-your-work/).

Please limit your branch changes to a single feature, sample, or bug fix for easier debugging, verification, and code review. This means for multiple samples or fixes you’ll have to create more than one branch with a correlating number of pull requests.

#### Adding Work

Using Visual Studio or your favorite editor, add your new content or edit existing files. You can commit multiple times while you are doing your work, or you can wait and commit only once when you're done.

#### New Samples

If making a new sample, you’ll want to create a new folder in the appropriate [Samples SDK folder](https://github.com/Microsoft/WindowsCompositionSamples/tree/master/SampleGallery/Samples) with a descriptive name. Copy the [sample template files](https://github.com/Microsoft/WindowsCompositionSamples/tree/master/SampleGallery/Samples/SampleTemplate) into your new folder and rename. You’ll also need to change the class names in both files, and add a good StaticSampleName and SampleDescription in the .cs file. The sample name should be short and match the intention of the sample; it will be the name displayed in the application. The description should be no more than a sentence and needs to concisely describe the purpose of the sample. It may also mention key APIs demonstrated.

References to the new files will need to be added to the [sample definition](https://github.com/Microsoft/WindowsCompositionSamples/blob/master/SampleGallery/Shared/SampleDefinition.cs) page in order for them to show up in the application. Please place the reference under the appropriate SDK version block check and fill in the necessary information.

You’ll notice the sample definition takes an imageUrl to use as the sample icon in the application, which you should place in the [Assets/SampleThumbnails](https://github.com/Microsoft/WindowsCompositionSamples/tree/master/SampleGallery/Assets/SampleThumbnails) folder.

#### Verifying Changes

To validate your changes, make sure you run all samples you have touched on x64, x86, and ARM. Please ensure that the project deploys to a mobile device or emulator as well as your desktop machine before submitting.

#### Submitting Pull Requests

After all changes have been committed and pushed to your branch, [create a pull request](https://github.com/Microsoft/WindowsCompositionSamples/compare). Please add a title and include a comment describing what changes have been made in detail. Double check that the Base branch is 'master' and your branch is the compared head.

If creating a pull request to fix an existing open GitHub issue, please make sure to cross-reference the issue in the pull request and vice versa by using [supported GitHub issue and pull request autolinking](https://help.github.com/articles/autolinked-references-and-urls/). If no issue exists, please first [create a GitHub Issue](https://github.com/Microsoft/WindowsCompositionSamples/issues/new) then add the cross-referencing.

Upon submitting the pull request, one of the site administrators will process it, review it, and provide feedback if necessary. Once all feedback is resolved, the pull request will be approved and integrated into the gallery.

## UserVoice, GitHub Issues, & StackOverflow

Alternative outlets for community participation are available through UserVoice, Github Issues, and StackOverflow.

The [UWP UserVoice site](https://wpdev.uservoice.com/forums/110705-universal-windows-platform/category/58517-xaml-controls-composition) can be used to vote on and create suggestions for improvements to the Windows developer platform. Suggestions are reviewed by the Windows platform developer team and your feedback is used for planning and understanding how developers use the platform.

This repo’s [GitHub Issues](https://github.com/Microsoft/WindowsCompositionSamples/issues) section can be used for asking questions about usage and bugs, but may also be used to respectfully interact with other community members to collaboratively answer questions and discover the innovative ways others are leveraging Windows APIs.

Finally, StackOverflow has an active community of Windows UI developers where you can ask questions. Tag with ['uwp'](https://stackoverflow.com/questions/tagged/uwp) (or your appropriate application architecture), and tags indicating your framework. Some known active tags for Composition include ['windows-composition-api'](https://stackoverflow.com/questions/tagged/windows-composition-api?mixed=1) and ['xaml-composition'](https://stackoverflow.com/questions/tagged/xaml-composition?mixed=1).
24 changes: 24 additions & 0 deletions Samples/Composition/SampleGallery/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The MIT License (MIT)


Copyright (c) Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions Samples/Composition/SampleGallery/PrivacyPolicy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Windows UI Sample Gallery Privacy Policy===========Personal Data We Collect-------------None.How We Use Your Personal Data-------------We do not collect or transmit any personal data. We do not store any personal data. Reasons We Share Your Personal Data-------------We do not collect personal data and therefore do not share any of your personal data.Control You Have Over Your Personal Data-------------Because we do not collect any personal data we do not offer any control over the use and sharing of this information, nor do we offer access to this data.
Expand Down
76 changes: 76 additions & 0 deletions Samples/Composition/SampleGallery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: "Composition Sample Gallery"
page_type: sample
languages:
- csharp
- cpp
products:
- windows
- windows-app-sdk
urlFragment: rendering
description: "Sample Gallery that showcases different use cases for the rendering APIs within Microsoft.UI.Composition."
extendedZipContent:
- path: LICENSE
target: LICENSE
---

# Composition Samples

![app gif](https://media.giphy.com/media/Hx2beMDfEA7QqWPvD4/giphy.gif)

Welcome to the Composition Samples! For those of you familiar with the Universal Windows Platform Composition Samples, these samples are very similar but instead built on the APIs in the WinAppSDK (to learn more about the WinAppSDK, visit [here](https://docs.microsoft.com/windows/apps/windows-app-sdk/)). This is the place for the latest code samples, demos, and developer feedback around building beautiful and engaging WinUI3 apps. This repo focuses on the platform building blocks that make up the [Fluent Design System](https://fluent.microsoft.com/), with emphasis on creating UI using APIs in the [Microsoft.UI.Composition](https://docs.microsoft.com/windows/winui/api/microsoft.ui.composition) and [Microsoft.UI.Input](https://docs.microsoft.com/windows/winui/api/microsoft.ui.input) namespaces.

Inside this repo, you’ll find the following additional info:

* [Getting started building and deploying readme](STARTUP.md)
* [Info on Questions and Contributing](CONTRIBUTING.md)

If you are a developer getting familiar with the WinUI 3.0 platform, want to build beautiful and innovative UI experiences, and don't mind a few bugs here and there, then this is the place for you!

We also want to see what inspiring UX you're building, so feel free to reach out on Twitter [@WindowsUI](https://twitter.com/windowsui).

## Project Structure

The following outlines the key folders for the project.

### Demos

The Demos folder contains standalone code demos that are focused on combining many concepts and feature sets into interesting user experiences.

### Sample Gallery

The Sample Gallery is an application that contains many samples, each demonstrating a different concept or API. The WinAppSDK samples automatically work downlevel to Windows 10 version 1809 (build 17763) which means as long as your Windows OS version is 1809 or higher, you'll automatically get all the latest features.

### Samples Common

These are early reference implementations, prototypes, and utilities the team has built over the course of developing our demos and code examples. This is a set of common code patterns that are shared across code samples and demos.

### ExpressionBuilder

A set of C# classes enabling you to build ExpressionAnimations in a more type-safe environment.

### Samples Native

A native library used to access some lower-level functionality that has no WinRT projections.

## Contributing

We encourage and welcome community involvement and contribution in this project. You'll find some details and guidelines for contribution in the [contributing readme](CONTRIBUTING.md).

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Related Projects

This project is focused on experimenting with Microsoft.UI.Composition and Microsoft.UI.Input APIs to create beautiful, unique, and engaging user experiences. If instead you’re looking to get started with higher-level UI concepts with heavier focus on XAML-based controls, check out related projects:

* [Xaml Controls Gallery](https://github.com/microsoft/Xaml-Controls-Gallery/tree/winui3) for WinUI3 controls-based UI
* [Windows UI Library (WinUI)](https://docs.microsoft.com/windows/apps/winui/) NuGet packages for XAML controls
* [Windows App SDK](https://docs.microsoft.com/windows/apps/windows-app-sdk/) Documentation for the new WinAppSDK

## Privacy

These samples do not collect any telemetry. A detailed privacy agreement can be found [here](https://go.microsoft.com/fwlink/?LinkId=521839) or in the 'Settings' section of the app.

## Images

The images used in this application are sourced from a variety of Microsoft employees, but we'd like to specially thank Conroy for his contribution. [See more of his content here.](https://www.instagram.com/conroy.williamson/)
19 changes: 19 additions & 0 deletions Samples/Composition/SampleGallery/STARTUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Getting Started

Here you'll find some helpful guidance on how to locally build and run this project.

## Prerequisites

For local development, please visit this [link](https://docs.microsoft.com/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs%2Cstable) to set up your development environment before building this project.

## Cloning and Building

Once you have Visual Studio and the appropriate SDK(s) installed, clone the Windows Composition Samples repo locally. Cloning instructions can be found [here](https://help.github.com/articles/cloning-a-repository/).

Open the SampleGallery solution file (.sln extension) in Visual Studio to view and manage the project.

Open up the Solution Explorer (Under the "View" menu item in the top left), right click the SampleGalleryPkg and click "Set as Startup Project". You will also need to change the solution platform to x64 instead of Arm64.

You'll want to restore dependencies or install yourself through NuGet in order to avoid dependency errors. To manage the NuGet dependencies in Visual Studio, right click the Sample Gallery project and select 'Manage NuGet Packages', then search for and install necessary dependencies.

Clean the solution, then build and deploy it to run the application.
17 changes: 17 additions & 0 deletions Samples/Composition/SampleGallery/cs-winui/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Thanks for taking the time to file an issue. Someone from our team will take a look and get back to you as soon as possible. -->

## Issue Type
<!-- Please check one of the following with an “x” to indicate what type of issue you’re submitting-->
[ ] Bug Report <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature Request <!-- Please file a UserVoice request and include the link below https://wpdev.uservoice.com/forums/110705-universal-windows-platform/category/58517-xaml-controls-composition -->
[ ] Sample request
[ ] Documentation issue or request
[ ] Other – Please describe:

## UserVoice link
<!-- If requesting new functionality -->

## Current Behavior
<!-- If filing a bug, describe what happens instead of the expected behavior. Please include a screenshot or gif if applicable. -->
<!-- If suggesting a change/improvement, explain the difference from current behavior -->

## Expected Behavior
<!-- If filing a bug, tell us what expected/desired behavior is -->
<!-- If suggesting a change/improvement, tell us how it should work -->

## Steps to Reproduce (for bugs)
<!-- Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.

## Your Environment
<!-- Provide details on relevant environment version numbers -->
* SDK #:
* Operating System build # :
* Visual Studio Version # :
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Thanks for contributing to WindowsCompositionSamples! Someone from our team will take a look and get back to you as soon as possible. -->

## Pull Request Type
[ ] Bugfix <!—Please add link to related Issue below -->
[ ] New Sample
[ ] Other - Please describe:

## Issue
<!-- Link to any relevant issues --> #

## Proposed Changes
-
-

## Screenshot/GIF (if applicable):
Loading