-
Notifications
You must be signed in to change notification settings - Fork 327
Add FocusVisuals and TouchKeyboard samples (WinUI 3 migration from UWP) #649
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
Open
qiutongMS
wants to merge
3
commits into
release/experimental
Choose a base branch
from
user/qiutongshen/migrate-uwp-sample
base: release/experimental
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- Copyright (c) Microsoft Corporation. | ||
| Licensed under the MIT License. --> | ||
| <Application | ||
| x:Class="FocusVisualsSample.App" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:FocusVisualsSample"> | ||
| <Application.Resources> | ||
| <ResourceDictionary> | ||
| <ResourceDictionary.MergedDictionaries> | ||
| <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> | ||
| <ResourceDictionary Source="Themes/Generic.xaml" /> | ||
| </ResourceDictionary.MergedDictionaries> | ||
| </ResourceDictionary> | ||
| </Application.Resources> | ||
| </Application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.UI.Xaml; | ||
|
|
||
| namespace FocusVisualsSample; | ||
|
|
||
| public partial class App : Application | ||
| { | ||
| public App() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) | ||
| { | ||
| var window = new MainWindow(); | ||
| window.Activate(); | ||
| } | ||
| } | ||
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+574 Bytes
...FocusVisuals/cs-winui/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.07 KB
...Visuals/cs-winui/Assets/Square44x44Logo.targetsize-48_altform-lightunplated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>WinExe</OutputType> | ||
| <TargetFramework>net9.0-windows10.0.19041.0</TargetFramework> | ||
| <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> | ||
| <RootNamespace>FocusVisualsSample</RootNamespace> | ||
| <ApplicationManifest>app.manifest</ApplicationManifest> | ||
| <Platforms>x86;x64;ARM64</Platforms> | ||
| <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers> | ||
| <UseWinUI>true</UseWinUI> | ||
| <EnablePreviewMsixTooling>true</EnablePreviewMsixTooling> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.WindowsAppSDK" /> | ||
| <PackageReference Include="Microsoft.Windows.SDK.BuildTools" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Manifest Include="$(ApplicationManifest)" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Content Include="Assets\SplashScreen.scale-200.png" /> | ||
| <Content Include="Assets\LockScreenLogo.scale-200.png" /> | ||
| <Content Include="Assets\Square150x150Logo.scale-200.png" /> | ||
| <Content Include="Assets\Square44x44Logo.scale-200.png" /> | ||
| <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> | ||
| <Content Include="Assets\Square44x44Logo.targetsize-48_altform-lightunplated.png" /> | ||
| <Content Include="Assets\StoreLogo.png" /> | ||
| <Content Include="Assets\AppIcon.ico" /> | ||
| <Content Include="Assets\Wide310x150Logo.scale-200.png" /> | ||
| <Content Include="Assets\yammer_share.png" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging | ||
| Tools extension to be activated for this project even if the Windows App SDK Nuget | ||
| package has not yet been restored --> | ||
| <ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnablePreviewMsixTooling)'=='true'"> | ||
| <ProjectCapability Include="Msix" /> | ||
| </ItemGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 17 | ||
| VisualStudioVersion = 17.0.31903.59 | ||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FocusVisualsSample", "FocusVisualsSample.csproj", "{BCDC1789-5958-4152-87F6-3BED4C6E4B2F}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Debug|ARM64 = Debug|ARM64 | ||
| Debug|x64 = Debug|x64 | ||
| Debug|x86 = Debug|x86 | ||
| Release|Any CPU = Release|Any CPU | ||
| Release|ARM64 = Release|ARM64 | ||
| Release|x64 = Release|x64 | ||
| Release|x86 = Release|x86 | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|Any CPU.ActiveCfg = Debug|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|Any CPU.Build.0 = Debug|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|ARM64.Deploy.0 = Debug|ARM64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|x64.Build.0 = Debug|x64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|x64.Deploy.0 = Debug|x64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|x86.ActiveCfg = Debug|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Debug|x86.Build.0 = Debug|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|Any CPU.ActiveCfg = Release|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|Any CPU.Build.0 = Release|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|ARM64.Build.0 = Release|ARM64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|ARM64.Deploy.0 = Release|ARM64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|x64.ActiveCfg = Release|x64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|x64.Build.0 = Release|x64 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|x86.ActiveCfg = Release|x86 | ||
| {BCDC1789-5958-4152-87F6-3BED4C6E4B2F}.Release|x86.Build.0 = Release|x86 | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
| EndGlobalSection | ||
| EndGlobal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright (c) Microsoft Corporation. | ||
| Licensed under the MIT License. --> | ||
| <Window | ||
| x:Class="FocusVisualsSample.MainWindow" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:local="using:FocusVisualsSample" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| Title="Focus Visuals Sample" | ||
| mc:Ignorable="d"> | ||
| <Window.SystemBackdrop> | ||
| <MicaBackdrop /> | ||
| </Window.SystemBackdrop> | ||
|
|
||
| <Grid> | ||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="Auto" /> | ||
| <RowDefinition Height="*" /> | ||
| </Grid.RowDefinitions> | ||
|
|
||
| <TitleBar x:Name="AppTitleBar" Title="Focus Visuals Sample"> | ||
| <TitleBar.IconSource> | ||
| <ImageIconSource ImageSource="Assets/AppIcon.ico" /> | ||
| </TitleBar.IconSource> | ||
| </TitleBar> | ||
|
|
||
| <NavigationView | ||
| x:Name="NavView" | ||
| Grid.Row="1" | ||
| IsBackButtonVisible="Collapsed" | ||
| IsSettingsVisible="False" | ||
| SelectionChanged="NavView_SelectionChanged" | ||
| AutomationProperties.AutomationId="NavView"> | ||
| <NavigationView.MenuItems> | ||
| <NavigationViewItem Content="Custom focus visuals" Tag="CustomFocusVisuals" AutomationProperties.AutomationId="NavItemCustomFocusVisuals"> | ||
| <NavigationViewItem.Icon> | ||
| <FontIcon Glyph="" /> | ||
| </NavigationViewItem.Icon> | ||
| </NavigationViewItem> | ||
| <NavigationViewItem Content="Custom control usage" Tag="CustomControlUsage" AutomationProperties.AutomationId="NavItemCustomControlUsage"> | ||
| <NavigationViewItem.Icon> | ||
| <FontIcon Glyph="" /> | ||
| </NavigationViewItem.Icon> | ||
| </NavigationViewItem> | ||
| </NavigationView.MenuItems> | ||
|
|
||
| <Frame x:Name="ContentFrame" /> | ||
| </NavigationView> | ||
| </Grid> | ||
| </Window> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.UI.Xaml; | ||
| using Microsoft.UI.Xaml.Controls; | ||
| using FocusVisualsSample.Scenarios; | ||
|
|
||
| namespace FocusVisualsSample; | ||
|
|
||
| public sealed partial class MainWindow : Window | ||
| { | ||
| public MainWindow() | ||
| { | ||
| InitializeComponent(); | ||
|
|
||
| ExtendsContentIntoTitleBar = true; | ||
| SetTitleBar(AppTitleBar); | ||
|
|
||
| AppWindow.SetIcon("Assets/AppIcon.ico"); | ||
|
|
||
| // Select the first navigation item on startup. | ||
| NavView.SelectedItem = NavView.MenuItems[0]; | ||
| } | ||
|
|
||
| private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) | ||
| { | ||
| if (args.SelectedItem is NavigationViewItem item) | ||
| { | ||
| var tag = item.Tag?.ToString(); | ||
| switch (tag) | ||
| { | ||
| case "CustomFocusVisuals": | ||
| ContentFrame.Navigate(typeof(CustomFocusVisualsPage)); | ||
| break; | ||
| case "CustomControlUsage": | ||
| ContentFrame.Navigate(typeof(CustomControlUsagePage)); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
|
||
| <Package | ||
| xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" | ||
| xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" | ||
| xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" | ||
| xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" | ||
| IgnorableNamespaces="uap rescap"> | ||
|
|
||
| <Identity | ||
| Name="756EB3FD-BD17-4AB4-83AE-342BF1467A92" | ||
| Publisher="CN=AppPublisher" | ||
| Version="1.0.0.0" /> | ||
|
|
||
| <mp:PhoneIdentity PhoneProductId="756EB3FD-BD17-4AB4-83AE-342BF1467A92" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> | ||
|
|
||
| <Properties> | ||
| <DisplayName>FocusVisualsSample</DisplayName> | ||
| <PublisherDisplayName>AppPublisher</PublisherDisplayName> | ||
| <Logo>Assets\StoreLogo.png</Logo> | ||
| </Properties> | ||
|
|
||
| <Dependencies> | ||
| <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" /> | ||
| <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" /> | ||
| </Dependencies> | ||
|
|
||
| <Resources> | ||
| <Resource Language="x-generate"/> | ||
| </Resources> | ||
|
|
||
| <Applications> | ||
| <Application Id="App" | ||
| Executable="$targetnametoken$.exe" | ||
| EntryPoint="$targetentrypoint$"> | ||
| <uap:VisualElements | ||
| DisplayName="FocusVisualsSample" | ||
| Description="FocusVisualsSample" | ||
| BackgroundColor="transparent" | ||
| Square150x150Logo="Assets\Square150x150Logo.png" | ||
| Square44x44Logo="Assets\Square44x44Logo.png"> | ||
| <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" /> | ||
| <uap:SplashScreen Image="Assets\SplashScreen.png" /> | ||
| </uap:VisualElements> | ||
| </Application> | ||
| </Applications> | ||
|
|
||
| <Capabilities> | ||
| <rescap:Capability Name="runFullTrust" /> | ||
| </Capabilities> | ||
| </Package> |
10 changes: 10 additions & 0 deletions
10
Samples/FocusVisuals/cs-winui/Properties/launchSettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "profiles": { | ||
| "FocusVisualsSample (Package)": { | ||
| "commandName": "MsixPackage" | ||
| }, | ||
| "FocusVisualsSample (Unpackaged)": { | ||
| "commandName": "Project" | ||
| } | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
Samples/FocusVisuals/cs-winui/Scenarios/CustomControlUsagePage.xaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <!-- Copyright (c) Microsoft Corporation. | ||
| Licensed under the MIT License. --> | ||
| <Page | ||
| x:Class="FocusVisualsSample.Scenarios.CustomControlUsagePage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:FocusVisualsSample" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <ScrollViewer VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto"> | ||
| <StackPanel Margin="24" Spacing="16"> | ||
| <TextBlock Text="Applying system focus visuals to custom controls" Style="{StaticResource SubtitleTextBlockStyle}" /> | ||
| <RichTextBlock> | ||
| <Paragraph>The same focus visuals used for in-box controls can be applied to custom controls as well.</Paragraph> | ||
| <Paragraph>Simply set Control.UseSystemFocusVisuals to True, and it will draw the focus visuals around the bounds of your control.</Paragraph> | ||
| <Paragraph>If you need to specify a specific template part to be the bounds of the focus visual, use the attached property Control.IsTemplateFocusTarget and set it to true.</Paragraph> | ||
| </RichTextBlock> | ||
|
|
||
| <local:SocialMediaCounter ShareImage="ms-appx:///Assets/yammer_share.png" NavigateUri="https://www.yammer.com/" NumOfShares="12" VerticalAlignment="Top" AutomationProperties.AutomationId="SocialMediaCounterControl" AutomationProperties.Name="Share on Yammer" /> | ||
| </StackPanel> | ||
| </ScrollViewer> | ||
| </Page> |
14 changes: 14 additions & 0 deletions
14
Samples/FocusVisuals/cs-winui/Scenarios/CustomControlUsagePage.xaml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.UI.Xaml.Controls; | ||
|
|
||
| namespace FocusVisualsSample.Scenarios; | ||
|
|
||
| public sealed partial class CustomControlUsagePage : Page | ||
| { | ||
| public CustomControlUsagePage() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.