Compare commits

...

7 Commits

Author SHA1 Message Date
Shawn Yuan
83feeb67f1 fix build pipeline falied issue 2026-02-13 16:41:29 +08:00
Shawn Yuan
bb4c548a4b Update BuildWithLatestWinAppSdkDaily pipeline (#45555)
<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request introduces an "artifact-based" mode for consuming the
Windows App SDK in CI pipelines, allowing builds to use NuGet packages
directly from Azure DevOps pipeline artifacts instead of public/internal
feeds. This is achieved by adding new parameters and logic to pipeline
YAML and PowerShell scripts, supporting scenarios where packages are not
yet published to a feed. The changes also improve robustness when
updating package versions and add documentation for authentication
requirements.

These changes make the pipeline more flexible and robust, enabling
builds to consume unreleased or pre-release packages directly from CI
artifacts, which is especially useful for testing and validation
scenarios.
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-02-13 12:27:21 +08:00
Jiří Polášek
64298a5414 CmdPal: Localize the "More" button on the command bar and hotkeys (#45505)
## Summary of the Pull Request

Enable localization for command bar buttons and modifiers

- Adds localization support for the "More" command button on the command
bar
- Localizes the secondary command key modifier (Ctrl) and its
combinations
- Updates related tooltips for improved consistency
- Enhances the overall user experience for non-English locales

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #45503
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-02-12 20:38:10 +01:00
Mike Griese
efc3c5e5c8 CmdPal: Add Dock API (#45432)
This doesn't actually add the dock. It just adds the API for it.

Extension authors can use this to create their own dock bands.

re: #45201
2026-02-12 12:59:15 -06:00
Niels Laute
75bf64299d Creating a Common.UI.Controls lib (#45542)
## Summary of the Pull Request

@jiripolasek FYI

This PR creates a new `Common.UI.Controls` library that contains shared
WinUI controls. We have been copying code manually between CmdPal and
Settings, and now with the new KBM we will run into the same issue.

This lib has shared controls projects can add to their proj so we have a
single source of truth.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #45388

<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

---------

Co-authored-by: Jiří Polášek <me@jiripolasek.com>
2026-02-12 16:45:44 +01:00
Jiří Polášek
795c64cc72 CmdPal: Manually iterate package metadata tags to prevent exceptions (#45502)
## Summary of the Pull Request

This PR fixes an error that occurred when reading tags for the selected
package in WinGet extensions when AOTed. The issue was caused by using
LINQ over a WinRT proxy; this has been replaced with manual iteration
over the collection to avoid the failure.

The exception is now caught and logged as a warning by #44757.

<img width="863" height="500" alt="image"
src="https://github.com/user-attachments/assets/6e08e674-532e-4e9b-a5c6-f7e1c224c341"
/>

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #44487
- [x] Closes: #44486
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-02-12 09:35:56 -06:00
Jiří Polášek
aca0b9c747 CmdPal: Clipboard history - localize metadata strings (#45506)
## Summary of the Pull Request

This PR enables the localization of strings in metadata providers
(section titles and keys) and other unlocalized strings in Clipboard
History built-in extension.

## PR Checklist

- [x] Closes: #42185
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2026-02-12 09:34:48 -06:00
85 changed files with 1490 additions and 891 deletions

View File

@@ -207,6 +207,7 @@ Bilibili
BVID
capturevideosample
cmdow
Contoso
Controlz
cortana
devhints

View File

@@ -1072,6 +1072,7 @@ Metacharacter
metadatamatters
Metadatas
metafile
metapackage
mfc
Mgmt
Microwaved
@@ -1497,6 +1498,7 @@ psz
ptb
ptc
PTCHAR
ptcontrols
ptd
PTOKEN
PToy

View File

@@ -127,6 +127,7 @@
"WinUI3Apps\\PowerToys.QuickAccess.dll",
"WinUI3Apps\\PowerToys.QuickAccess.exe",
"WinUI3Apps\\PowerToys.Common.UI.Controls.dll",
"WinUI3Apps\\PowerToys.Settings.UI.Controls.dll",
"WinUI3Apps\\PowerToys.EnvironmentVariablesModuleInterface.dll",

View File

@@ -13,9 +13,36 @@ Param(
# Root folder Path for processing
[Parameter(Mandatory=$False,Position=4)]
[string]$sourceLink = "https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json"
[string]$sourceLink = "https://microsoft.pkgs.visualstudio.com/ProjectReunion/_packaging/Project.Reunion.nuget.internal/nuget/v3/index.json",
# Use Azure Pipeline artifact as source for metapackage
[Parameter(Mandatory=$False,Position=5)]
[boolean]$useArtifactSource = $False,
# Azure DevOps organization URL
[Parameter(Mandatory=$False,Position=6)]
[string]$azureDevOpsOrg = "https://dev.azure.com/microsoft",
# Azure DevOps project name
[Parameter(Mandatory=$False,Position=7)]
[string]$azureDevOpsProject = "ProjectReunion",
# Pipeline build ID (or "latest" for latest build)
[Parameter(Mandatory=$False,Position=8)]
[string]$buildId = "",
# Artifact name containing the NuGet packages
[Parameter(Mandatory=$False,Position=9)]
[string]$artifactName = "WindowsAppSDK_Nuget_And_MSIX",
# Metapackage name to look for in artifact
[Parameter(Mandatory=$False,Position=10)]
[string]$metaPackageName = "Microsoft.WindowsAppSDK"
)
# Script-level constants
$script:PackageVersionRegex = '^(.+?)\.(\d+\..*)$'
function Read-FileWithEncoding {
@@ -57,7 +84,7 @@ function Add-NuGetSourceAndMapping {
# Ensure packageSources exists
if (-not $Xml.configuration.packageSources) {
$Xml.configuration.AppendChild($Xml.CreateElement("packageSources")) | Out-Null
$null = $Xml.configuration.AppendChild($Xml.CreateElement("packageSources"))
}
$sources = $Xml.configuration.packageSources
@@ -66,13 +93,13 @@ function Add-NuGetSourceAndMapping {
if (-not $sourceNode) {
$sourceNode = $Xml.CreateElement("add")
$sourceNode.SetAttribute("key", $Key)
$sources.AppendChild($sourceNode) | Out-Null
$null = $sources.AppendChild($sourceNode)
}
$sourceNode.SetAttribute("value", $Value)
# Ensure packageSourceMapping exists
if (-not $Xml.configuration.packageSourceMapping) {
$Xml.configuration.AppendChild($Xml.CreateElement("packageSourceMapping")) | Out-Null
$null = $Xml.configuration.AppendChild($Xml.CreateElement("packageSourceMapping"))
}
$mapping = $Xml.configuration.packageSourceMapping
@@ -80,7 +107,7 @@ function Add-NuGetSourceAndMapping {
$invalidNodes = $mapping.SelectNodes("packageSource[not(@key) or @key='']")
if ($invalidNodes) {
foreach ($node in $invalidNodes) {
$mapping.RemoveChild($node) | Out-Null
$null = $mapping.RemoveChild($node)
}
}
@@ -91,9 +118,9 @@ function Add-NuGetSourceAndMapping {
$mappingSource.SetAttribute("key", $Key)
# Insert at top for priority
if ($mapping.HasChildNodes) {
$mapping.InsertBefore($mappingSource, $mapping.FirstChild) | Out-Null
$null = $mapping.InsertBefore($mappingSource, $mapping.FirstChild)
} else {
$mapping.AppendChild($mappingSource) | Out-Null
$null = $mapping.AppendChild($mappingSource)
}
}
@@ -110,14 +137,273 @@ function Add-NuGetSourceAndMapping {
foreach ($pattern in $Patterns) {
$pkg = $Xml.CreateElement("package")
$pkg.SetAttribute("pattern", $pattern)
$mappingSource.AppendChild($pkg) | Out-Null
$null = $mappingSource.AppendChild($pkg)
}
}
function Download-ArtifactFromPipeline {
param (
[string]$Organization,
[string]$Project,
[string]$BuildId,
[string]$ArtifactName,
[string]$OutputDir
)
Write-Host "Downloading artifact '$ArtifactName' from build $BuildId..."
$null = New-Item -ItemType Directory -Path $OutputDir -Force
try {
# Authenticate with Azure DevOps using System Access Token (if available)
if ($env:SYSTEM_ACCESSTOKEN) {
Write-Host "Authenticating with Azure DevOps using System Access Token..."
$env:AZURE_DEVOPS_EXT_PAT = $env:SYSTEM_ACCESSTOKEN
} else {
Write-Host "No SYSTEM_ACCESSTOKEN found, assuming az CLI is already authenticated..."
}
# Use az CLI to download artifact
& az pipelines runs artifact download `
--organization $Organization `
--project $Project `
--run-id $BuildId `
--artifact-name $ArtifactName `
--path $OutputDir
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully downloaded artifact to $OutputDir"
return $true
} else {
Write-Warning "Failed to download artifact. Exit code: $LASTEXITCODE"
return $false
}
} catch {
Write-Warning "Error downloading artifact: $_"
return $false
}
}
function Get-NuspecDependencies {
param (
[string]$NupkgPath,
[string]$TargetFramework = ""
)
$tempDir = Join-Path $env:TEMP "nuspec_parse_$(Get-Random)"
try {
# Extract .nupkg (it's a zip file)
# Workaround: Expand-Archive may not recognize .nupkg extension, so copy to .zip first
$tempZip = Join-Path $env:TEMP "temp_$(Get-Random).zip"
Copy-Item $NupkgPath -Destination $tempZip -Force
Expand-Archive -Path $tempZip -DestinationPath $tempDir -Force
Remove-Item $tempZip -Force -ErrorAction SilentlyContinue
# Find .nuspec file
$nuspecFile = Get-ChildItem -Path $tempDir -Filter "*.nuspec" -Recurse | Select-Object -First 1
if (-not $nuspecFile) {
Write-Warning "No .nuspec file found in $NupkgPath"
return @{}
}
[xml]$nuspec = Get-Content $nuspecFile.FullName
# Extract package info
$packageId = $nuspec.package.metadata.id
$version = $nuspec.package.metadata.version
Write-Host "Parsing $packageId version $version"
# Parse dependencies
$dependencies = @{}
$depGroups = $nuspec.package.metadata.dependencies.group
if ($depGroups) {
# Dependencies are grouped by target framework
foreach ($group in $depGroups) {
$fx = $group.targetFramework
Write-Host " Target Framework: $fx"
foreach ($dep in $group.dependency) {
$depId = $dep.id
$depVer = $dep.version
# Remove version range brackets if present (e.g., "[2.0.0]" -> "2.0.0")
$depVer = $depVer -replace '[\[\]]', ''
$dependencies[$depId] = $depVer
Write-Host " - ${depId} : ${depVer}"
}
}
} else {
# No grouping, direct dependencies
$deps = $nuspec.package.metadata.dependencies.dependency
if ($deps) {
foreach ($dep in $deps) {
$depId = $dep.id
$depVer = $dep.version
$depVer = $depVer -replace '[\[\]]', ''
$dependencies[$depId] = $depVer
Write-Host " - ${depId} : ${depVer}"
}
}
}
return $dependencies
}
catch {
Write-Warning "Failed to parse nuspec: $_"
return @{}
}
finally {
Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}
}
function Resolve-ArtifactBasedDependencies {
param (
[string]$ArtifactDir,
[string]$MetaPackageName,
[string]$SourceUrl,
[string]$OutputDir
)
Write-Host "Resolving dependencies from artifact-based metapackage..."
$null = New-Item -ItemType Directory -Path $OutputDir -Force
# Find the metapackage in artifact
$metaNupkg = Get-ChildItem -Path $ArtifactDir -Recurse -Filter "$MetaPackageName.*.nupkg" |
Where-Object { $_.Name -notmatch "Runtime" } |
Select-Object -First 1
if (-not $metaNupkg) {
Write-Warning "Metapackage $MetaPackageName not found in artifact"
return @{}
}
# Extract version from filename
if ($metaNupkg.Name -match "$MetaPackageName\.(.+)\.nupkg") {
$metaVersion = $Matches[1]
Write-Host "Found metapackage: $MetaPackageName version $metaVersion"
} else {
Write-Warning "Could not extract version from $($metaNupkg.Name)"
return @{}
}
# Parse dependencies from metapackage
$dependencies = Get-NuspecDependencies -NupkgPath $metaNupkg.FullName
# Copy metapackage to output directory
Copy-Item $metaNupkg.FullName -Destination $OutputDir -Force
Write-Host "Copied metapackage to $OutputDir"
# Prepare package versions hashtable - initialize with metapackage version
$packageVersions = @{ $MetaPackageName = $metaVersion }
# Copy Runtime package from artifact (it's not in feed) and extract its version
$runtimeNupkg = Get-ChildItem -Path $ArtifactDir -Recurse -Filter "$MetaPackageName.Runtime.*.nupkg" | Select-Object -First 1
if ($runtimeNupkg) {
Copy-Item $runtimeNupkg.FullName -Destination $OutputDir -Force
Write-Host "Copied Runtime package to $OutputDir"
# Extract version from Runtime package filename
if ($runtimeNupkg.Name -match "$MetaPackageName\.Runtime\.(.+)\.nupkg") {
$runtimeVersion = $Matches[1]
$packageVersions["$MetaPackageName.Runtime"] = $runtimeVersion
Write-Host "Extracted Runtime package version: $runtimeVersion"
} else {
Write-Warning "Could not extract version from Runtime package: $($runtimeNupkg.Name)"
}
}
# Download other dependencies from feed (excluding Runtime as it's already copied)
# Create temp nuget.config that includes both local packages and remote feed
# This allows NuGet to find packages already copied from artifact
$tempConfig = Join-Path $env:TEMP "nuget_artifact_$(Get-Random).config"
$tempConfigContent = @"
<?xml version='1.0' encoding='utf-8'?>
<configuration>
<packageSources>
<clear />
<add key='LocalPackages' value='$OutputDir' />
<add key='RemoteFeed' value='$SourceUrl' />
</packageSources>
</configuration>
"@
Set-Content -Path $tempConfig -Value $tempConfigContent
try {
foreach ($depId in $dependencies.Keys) {
# Skip Runtime as it's already copied from artifact
if ($depId -like "*Runtime*") {
# Don't overwrite the version we extracted from the Runtime package filename
if (-not $packageVersions.ContainsKey($depId)) {
$packageVersions[$depId] = $dependencies[$depId]
}
Write-Host "Skipping $depId (already in artifact)"
continue
}
$depVersion = $dependencies[$depId]
Write-Host "Downloading dependency: $depId version $depVersion from feed..."
& nuget install $depId `
-Version $depVersion `
-ConfigFile $tempConfig `
-OutputDirectory $OutputDir `
-NonInteractive `
-NoCache `
| Out-Null
if ($LASTEXITCODE -eq 0) {
$packageVersions[$depId] = $depVersion
Write-Host " Successfully downloaded $depId"
} else {
Write-Warning " Failed to download $depId version $depVersion"
}
}
}
finally {
Remove-Item $tempConfig -Force -ErrorAction SilentlyContinue
}
# Parse all downloaded packages to get actual versions
$directories = Get-ChildItem -Path $OutputDir -Directory
$allLocalPackages = @()
# Add metapackage and runtime to the list (they are .nupkg files, not directories)
$allLocalPackages += $MetaPackageName
if ($packageVersions.ContainsKey("$MetaPackageName.Runtime")) {
$allLocalPackages += "$MetaPackageName.Runtime"
}
foreach ($dir in $directories) {
if ($dir.Name -match $script:PackageVersionRegex) {
$pkgId = $Matches[1]
$pkgVer = $Matches[2]
$allLocalPackages += $pkgId
if (-not $packageVersions.ContainsKey($pkgId)) {
$packageVersions[$pkgId] = $pkgVer
}
}
}
# Update nuget.config dynamically during pipeline execution
# This modification is temporary and won't be committed back to the repo
$nugetConfig = Join-Path $rootPath "nuget.config"
$configData = Read-FileWithEncoding -Path $nugetConfig
[xml]$xml = $configData.Content
Add-NuGetSourceAndMapping -Xml $xml -Key "localpackages" -Value $OutputDir -Patterns $allLocalPackages
$xml.Save($nugetConfig)
Write-Host "Updated nuget.config with localpackages mapping (temporary, for pipeline execution only)."
return ,$packageVersions
}
function Resolve-WinAppSdkSplitDependencies {
Write-Host "Version $WinAppSDKVersion detected. Resolving split dependencies..."
$installDir = Join-Path $rootPath "localpackages\output"
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
$null = New-Item -ItemType Directory -Path $installDir -Force
# Create a temporary nuget.config to avoid interference from the repo's config
$tempConfig = Join-Path $env:TEMP "nuget_$(Get-Random).config"
@@ -131,14 +417,24 @@ function Resolve-WinAppSdkSplitDependencies {
if ($propsContent -match '<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="([^"]+)"') {
$buildToolsVersion = $Matches[1]
Write-Host "Downloading Microsoft.Windows.SDK.BuildTools version $buildToolsVersion..."
$nugetArgsBuildTools = "install Microsoft.Windows.SDK.BuildTools -Version $buildToolsVersion -ConfigFile $tempConfig -OutputDirectory $installDir -NonInteractive -NoCache"
Invoke-Expression "nuget $nugetArgsBuildTools" | Out-Null
& nuget install Microsoft.Windows.SDK.BuildTools `
-Version $buildToolsVersion `
-ConfigFile $tempConfig `
-OutputDirectory $installDir `
-NonInteractive `
-NoCache `
| Out-Null
}
}
# Download package to inspect nuspec and keep it for the build
$nugetArgs = "install Microsoft.WindowsAppSDK -Version $WinAppSDKVersion -ConfigFile $tempConfig -OutputDirectory $installDir -NonInteractive -NoCache"
Invoke-Expression "nuget $nugetArgs" | Out-Null
& nuget install Microsoft.WindowsAppSDK `
-Version $WinAppSDKVersion `
-ConfigFile $tempConfig `
-OutputDirectory $installDir `
-NonInteractive `
-NoCache `
| Out-Null
# Parse dependencies from the installed folders
# Folder structure is typically {PackageId}.{Version}
@@ -172,52 +468,101 @@ function Resolve-WinAppSdkSplitDependencies {
}
}
# Execute nuget list and capture the output
if ($useExperimentalVersion) {
# The nuget list for experimental versions will cost more time
# So, we will not use -AllVersions to wast time
# But it can only get the latest experimental version
Write-Host "Fetching WindowsAppSDK with experimental versions"
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
-Source $sourceLink `
-Prerelease
# Filter versions based on the specified version prefix
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
$latestVersions = $filteredVersions
} else {
Write-Host "Fetching stable WindowsAppSDK versions for $winAppSdkVersionNumber"
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
-Source $sourceLink `
-AllVersions
# Filter versions based on the specified version prefix
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
$latestVersions = $filteredVersions | Sort-Object { [version]($_ -split ' ')[1] } -Descending | Select-Object -First 1
}
# Main logic: choose between artifact-based or feed-based approach
if ($useArtifactSource) {
Write-Host "=== Using Artifact-Based Source ===" -ForegroundColor Cyan
Write-Host "Organization: $azureDevOpsOrg"
Write-Host "Project: $azureDevOpsProject"
Write-Host "Build ID: $buildId"
Write-Host "Artifact: $artifactName"
Write-Host "Latest versions found: $latestVersions"
# Extract the latest version number from the output
$latestVersion = $latestVersions -split "`n" | `
Select-String -Pattern 'Microsoft.WindowsAppSDK\s*([0-9]+\.[0-9]+\.[0-9]+-*[a-zA-Z0-9]*)' | `
ForEach-Object { $_.Matches[0].Groups[1].Value } | `
Sort-Object -Descending | `
Select-Object -First 1
if ([string]::IsNullOrEmpty($buildId) -or $buildId -eq 'N/A') {
Write-Error "buildId parameter is required when using artifact source. Please provide a valid Windows App SDK Build ID."
Write-Host "Tip: You can find the build ID from the Windows App SDK pipeline run in Azure DevOps."
exit 1
}
if ($latestVersion) {
$WinAppSDKVersion = $latestVersion
Write-Host "Extracted version: $WinAppSDKVersion"
# Download artifact
$artifactDir = Join-Path $rootPath "localpackages\artifact"
$downloadSuccess = Download-ArtifactFromPipeline `
-Organization $azureDevOpsOrg `
-Project $azureDevOpsProject `
-BuildId $buildId `
-ArtifactName $artifactName `
-OutputDir $artifactDir
if (-not $downloadSuccess) {
Write-Host "Failed to download artifact"
exit 1
}
# Resolve dependencies from artifact
$installDir = Join-Path $rootPath "localpackages\output"
$packageVersions = Resolve-ArtifactBasedDependencies `
-ArtifactDir $artifactDir `
-MetaPackageName $metaPackageName `
-SourceUrl $sourceLink `
-OutputDir $installDir
if ($packageVersions.Count -eq 0) {
Write-Error "Failed to resolve dependencies from artifact"
exit 1
}
$WinAppSDKVersion = $packageVersions[$metaPackageName]
Write-Host "WinAppSDK Version: $WinAppSDKVersion"
Write-Host "##vso[task.setvariable variable=WinAppSDKVersion]$WinAppSDKVersion"
} else {
Write-Host "Failed to extract version number from nuget list output"
exit 1
Write-Host "=== Using Feed-Based Source ===" -ForegroundColor Cyan
# Execute nuget list and capture the output
if ($useExperimentalVersion) {
# The nuget list for experimental versions will cost more time
# So, we will not use -AllVersions to wast time
# But it can only get the latest experimental version
Write-Host "Fetching WindowsAppSDK with experimental versions"
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
-Source $sourceLink `
-Prerelease
# Filter versions based on the specified version prefix
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
$latestVersions = $filteredVersions
} else {
Write-Host "Fetching stable WindowsAppSDK versions for $winAppSdkVersionNumber"
$nugetOutput = nuget list Microsoft.WindowsAppSDK `
-Source $sourceLink `
-AllVersions
# Filter versions based on the specified version prefix
$escapedVersionNumber = [regex]::Escape($winAppSdkVersionNumber)
$filteredVersions = $nugetOutput | Where-Object { $_ -match "Microsoft.WindowsAppSDK $escapedVersionNumber\." }
$latestVersions = $filteredVersions | Sort-Object { [version]($_ -split ' ')[1] } -Descending | Select-Object -First 1
}
Write-Host "Latest versions found: $latestVersions"
# Extract the latest version number from the output
$latestVersion = $latestVersions -split "`n" | `
Select-String -Pattern 'Microsoft.WindowsAppSDK\s*([0-9]+\.[0-9]+\.[0-9]+-*[a-zA-Z0-9]*)' | `
ForEach-Object { $_.Matches[0].Groups[1].Value } | `
Sort-Object -Descending | `
Select-Object -First 1
if ($latestVersion) {
$WinAppSDKVersion = $latestVersion
Write-Host "Extracted version: $WinAppSDKVersion"
Write-Host "##vso[task.setvariable variable=WinAppSDKVersion]$WinAppSDKVersion"
} else {
Write-Host "Failed to extract version number from nuget list output"
exit 1
}
# Resolve dependencies for 1.8+
$packageVersions = @{ "Microsoft.WindowsAppSDK" = $WinAppSDKVersion }
Resolve-WinAppSdkSplitDependencies
}
# Resolve dependencies for 1.8+
$packageVersions = @{ "Microsoft.WindowsAppSDK" = $WinAppSDKVersion }
Resolve-WinAppSdkSplitDependencies
# Update Directory.Packages.props file
Get-ChildItem -Path $rootPath -Recurse "Directory.Packages.props" | ForEach-Object {
$file = Read-FileWithEncoding -Path $_.FullName
@@ -226,9 +571,16 @@ Get-ChildItem -Path $rootPath -Recurse "Directory.Packages.props" | ForEach-Obje
foreach ($pkgId in $packageVersions.Keys) {
$ver = $packageVersions[$pkgId]
# Skip packages with empty versions to prevent corruption
if ([string]::IsNullOrWhiteSpace($ver)) {
Write-Warning "Skipping ${pkgId}: version is empty"
continue
}
# Escape dots in package ID for regex
$pkgIdRegex = $pkgId -replace '\.', '\.'
$newVersionString = "<PackageVersion Include=""$pkgId"" Version=""$ver"" />"
$oldVersionString = "<PackageVersion Include=""$pkgIdRegex"" Version=""[-.0-9a-zA-Z]*"" />"

View File

@@ -1,3 +1,8 @@
# NOTE: When using artifact mode (useArtifactSource: true), the pipeline needs
# permission to access System.AccessToken. This is automatically handled by the
# script if SYSTEM_ACCESSTOKEN environment variable is available.
# If you encounter authentication errors, ensure the job has oauth access enabled.
trigger: none
pr: none
schedules:
@@ -37,6 +42,23 @@ parameters:
- name: useExperimentalVersion
type: boolean
default: false
# Artifact mode parameters (optional)
- name: useArtifactSource
type: boolean
displayName: "Use Artifact Source (instead of feed)"
default: false
- name: buildId
type: string
displayName: "Windows App SDK Build ID (required only if using artifact source)"
default: 'N/A'
- name: azureDevOpsProject
type: string
displayName: "Source Project (for artifact mode, default: ProjectReunion)"
default: 'ProjectReunion'
- name: artifactName
type: string
displayName: "Artifact Name (for artifact mode, default: WindowsAppSDK_Nuget_And_MSIX)"
default: 'WindowsAppSDK_Nuget_And_MSIX'
extends:
template: templates/pipeline-ci-build.yml
@@ -49,3 +71,7 @@ extends:
useLatestWinAppSDK: ${{ parameters.useLatestWinAppSDK }}
winAppSDKVersionNumber: ${{ parameters.winAppSDKVersionNumber }}
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
useArtifactSource: ${{ parameters.useArtifactSource }}
buildId: ${{ parameters.buildId }}
azureDevOpsProject: ${{ parameters.azureDevOpsProject }}
artifactName: ${{ parameters.artifactName }}

View File

@@ -74,6 +74,25 @@ parameters:
- name: useExperimentalVersion
type: boolean
default: false
# Artifact mode parameters
- name: useArtifactSource
type: boolean
default: false
- name: azureDevOpsOrg
type: string
default: 'https://dev.azure.com/microsoft'
- name: azureDevOpsProject
type: string
default: 'ProjectReunion'
- name: buildId
type: string
default: ''
- name: artifactName
type: string
default: 'WindowsAppSDK_Nuget_And_MSIX'
- name: metaPackageName
type: string
default: 'Microsoft.WindowsAppSDK'
- name: csProjectsToPublish
type: object
default:
@@ -226,6 +245,12 @@ jobs:
parameters:
versionNumber: ${{ parameters.winAppSDKVersionNumber }}
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
useArtifactSource: ${{ parameters.useArtifactSource }}
azureDevOpsOrg: ${{ parameters.azureDevOpsOrg }}
azureDevOpsProject: ${{ parameters.azureDevOpsProject }}
buildId: ${{ parameters.buildId }}
artifactName: ${{ parameters.artifactName }}
metaPackageName: ${{ parameters.metaPackageName }}
- ${{ if eq(parameters.useLatestWinAppSDK, false)}}:
- template: .\steps-restore-nuget.yml

View File

@@ -34,6 +34,25 @@ parameters:
- name: useExperimentalVersion
type: boolean
default: false
# Artifact mode parameters
- name: useArtifactSource
type: boolean
default: false
- name: azureDevOpsOrg
type: string
default: 'https://dev.azure.com/microsoft'
- name: azureDevOpsProject
type: string
default: 'ProjectReunion'
- name: buildId
type: string
default: ''
- name: artifactName
type: string
default: 'WindowsAppSDK_Nuget_And_MSIX'
- name: metaPackageName
type: string
default: 'Microsoft.WindowsAppSDK'
stages:
- ${{ each platform in parameters.buildPlatforms }}:
@@ -65,6 +84,12 @@ stages:
${{ if eq(parameters.useLatestWinAppSDK, true) }}:
winAppSDKVersionNumber: ${{ parameters.winAppSDKVersionNumber }}
useExperimentalVersion: ${{ parameters.useExperimentalVersion }}
useArtifactSource: ${{ parameters.useArtifactSource }}
azureDevOpsOrg: ${{ parameters.azureDevOpsOrg }}
azureDevOpsProject: ${{ parameters.azureDevOpsProject }}
buildId: ${{ parameters.buildId }}
artifactName: ${{ parameters.artifactName }}
metaPackageName: ${{ parameters.metaPackageName }}
timeoutInMinutes: 90
- stage: Build_SDK

View File

@@ -5,6 +5,25 @@ parameters:
- name: useExperimentalVersion
type: boolean
default: false
# Artifact mode parameters
- name: useArtifactSource
type: boolean
default: false
- name: azureDevOpsOrg
type: string
default: 'https://dev.azure.com/microsoft'
- name: azureDevOpsProject
type: string
default: 'ProjectReunion'
- name: buildId
type: string
default: ''
- name: artifactName
type: string
default: 'WindowsAppSDK_Nuget_And_MSIX'
- name: metaPackageName
type: string
default: 'Microsoft.WindowsAppSDK'
steps:
- task: NuGetAuthenticate@1
@@ -12,12 +31,20 @@ steps:
- task: PowerShell@2
displayName: Update WinAppSDK Versions
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
filePath: '$(build.sourcesdirectory)\.pipelines\UpdateVersions.ps1'
arguments: >
-winAppSdkVersionNumber ${{ parameters.versionNumber }}
-useExperimentalVersion $${{ parameters.useExperimentalVersion }}
-rootPath "$(build.sourcesdirectory)"
-useArtifactSource $${{ parameters.useArtifactSource }}
-azureDevOpsOrg "${{ parameters.azureDevOpsOrg }}"
-azureDevOpsProject "${{ parameters.azureDevOpsProject }}"
-buildId "${{ parameters.buildId }}"
-artifactName "${{ parameters.artifactName }}"
-metaPackageName "${{ parameters.metaPackageName }}"
# - task: NuGetCommand@2
# displayName: 'Restore NuGet packages (slnx)'
@@ -36,3 +63,4 @@ steps:
feedsToUse: 'config'
nugetConfigPath: '$(build.sourcesdirectory)\nuget.config'
workingDirectory: '$(build.sourcesdirectory)'
arguments: '/p:NoWarn=NU1602,NU1604'

View File

@@ -13,6 +13,10 @@
<Platform Solution="*|ARM64" Project="ARM64" />
<Platform Solution="*|x64" Project="x64" />
</Project>
<Project Path="src/common/Common.UI.Controls/Common.UI.Controls.csproj">
<Platform Solution="*|ARM64" Project="ARM64" />
<Platform Solution="*|x64" Project="x64" />
</Project>
<Project Path="src/common/COMUtils/COMUtils.vcxproj" Id="7319089e-46d6-4400-bc65-e39bdf1416ee" />
<Project Path="src/common/Display/Display.vcxproj" Id="caba8dfb-823b-4bf2-93ac-3f31984150d9" />
<Project Path="src/common/FilePreviewCommon/FilePreviewCommon.csproj">

View File

@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
<Import Project="$(RepoRoot)src\Common.SelfContained.props" />
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<RootNamespace>Microsoft.PowerToys.Common.UI.Controls</RootNamespace>
<AssemblyName>PowerToys.Common.UI.Controls</AssemblyName>
<UseWinUI>true</UseWinUI>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
<GenerateLibraryLayout>true</GenerateLibraryLayout>
<ProjectPriFileName>PowerToys.Common.UI.Controls.pri</ProjectPriFileName>
<Nullable>enable</Nullable>
<Platforms>x64;ARM64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" />
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ManagedCommon\ManagedCommon.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -8,7 +8,7 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
namespace Microsoft.PowerToys.Common.UI.Controls
{
public partial class CheckBoxWithDescriptionControl : CheckBox
{
@@ -39,7 +39,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
// Add text box only if the description is not empty. Required for additional plugin options.
if (!string.IsNullOrWhiteSpace(Description))
{
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)App.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)Application.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });
}
this.Content = panel;

View File

@@ -1,7 +1,7 @@
<ResourceDictionary
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls">
xmlns:controls="using:Microsoft.PowerToys.Common.UI.Controls">
<Style BasedOn="{StaticResource DefaultIsEnabledTextBlockStyle}" TargetType="controls:IsEnabledTextBlock" />
@@ -36,11 +36,13 @@
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="SecondaryIsEnabledTextBlockStyle"
BasedOn="{StaticResource DefaultIsEnabledTextBlockStyle}"
TargetType="controls:IsEnabledTextBlock">
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
<Setter Property="FontSize" Value="{StaticResource SecondaryTextFontSize}" />
<Setter Property="FontSize" Value="12" />
</Style>
</ResourceDictionary>

View File

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -7,7 +7,7 @@ using System.ComponentModel;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
namespace Microsoft.PowerToys.Common.UI.Controls
{
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
@@ -15,7 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
{
public IsEnabledTextBlock()
{
this.DefaultStyleKey = typeof(KeyVisual);
this.DefaultStyleKey = typeof(IsEnabledTextBlock);
}
protected override void OnApplyTemplate()

View File

@@ -2,7 +2,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:local="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI">
<Style BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter" />

View File

@@ -2,18 +2,10 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Documents;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
namespace Microsoft.PowerToys.Settings.UI.Controls;
namespace Microsoft.PowerToys.Common.UI.Controls;
public sealed partial class KeyCharPresenter : Control
{

View File

@@ -1,7 +1,7 @@
<ResourceDictionary
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
xmlns:local="using:Microsoft.PowerToys.Common.UI.Controls">
<Style BasedOn="{StaticResource DefaultKeyVisualStyle}" TargetType="local:KeyVisual" />
@@ -210,4 +210,4 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary>

View File

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
@@ -6,7 +6,7 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Windows.System;
namespace Microsoft.PowerToys.Settings.UI.Controls
namespace Microsoft.PowerToys.Common.UI.Controls
{
[TemplatePart(Name = KeyPresenter, Type = typeof(KeyCharPresenter))]
[TemplateVisualState(Name = NormalState, GroupName = "CommonStates")]
@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
private const string DisabledState = "Disabled";
private const string InvalidState = "Invalid";
private const string WarningState = "Warning";
private KeyCharPresenter _keyPresenter;
private KeyCharPresenter _keyPresenter = null!;
public object Content
{

View File

@@ -2,7 +2,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:local="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tk="using:CommunityToolkit.WinUI"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls">

View File

@@ -7,7 +7,7 @@ using CommunityToolkit.WinUI.Controls;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
namespace Microsoft.PowerToys.Common.UI.Controls
{
public sealed partial class ShortcutWithTextLabelControl : Control
{

View File

@@ -1,16 +1,11 @@
// Copyright (c) Microsoft Corporation
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.PowerToys.Settings.UI.Controls;
using Microsoft.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
namespace Microsoft.PowerToys.Common.UI.Controls
{
public partial class BoolToKeyVisualStateConverter : IValueConverter
{

View File

@@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyCharPresenter.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/ShortcutWithTextLabelControl/ShortcutWithTextLabelControl.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -3,6 +3,7 @@
"path": "..\\..\\..\\PowerToys.slnx",
"projects": [
"src\\common\\CalculatorEngineCommon\\CalculatorEngineCommon.vcxproj",
"src\\common\\Common.UI.Controls\\Common.UI.Controls.csproj",
"src\\common\\ManagedCommon\\ManagedCommon.csproj",
"src\\common\\ManagedCsWin32\\ManagedCsWin32.csproj",
"src\\common\\ManagedTelemetry\\Telemetry\\ManagedTelemetry.csproj",

View File

@@ -5,6 +5,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.CmdPal.UI.Controls"
xmlns:local="using:Microsoft.CmdPal.UI"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:services="using:Microsoft.CmdPal.UI.Services">
<Application.Resources>
<ResourceDictionary>
@@ -16,8 +17,10 @@
<ResourceDictionary Source="ms-appx:///Styles/TextBox.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/Settings.xaml" />
<ResourceDictionary Source="ms-appx:///Controls/Tag.xaml" />
<ResourceDictionary Source="ms-appx:///Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="ms-appx:///Controls/IsEnabledTextBlock.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyCharPresenter.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/ShortcutWithTextLabelControl/ShortcutWithTextLabelControl.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml" />
<!-- Default theme dictionary -->
<ResourceDictionary Source="ms-appx:///Styles/Theme.Normal.xaml" />
<services:MutableOverridesDictionary />
@@ -25,7 +28,7 @@
<!-- Other app resources here -->
<x:Double x:Key="SettingActionControlMinWidth">240</x:Double>
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="controls:CheckBoxWithDescriptionControl" />
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="ptcontrols:CheckBoxWithDescriptionControl" />
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@@ -1,76 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.CmdPal.UI.Controls;
public partial class CheckBoxWithDescriptionControl : CheckBox
{
private CheckBoxWithDescriptionControl _checkBoxSubTextControl;
public CheckBoxWithDescriptionControl()
{
_checkBoxSubTextControl = (CheckBoxWithDescriptionControl)this;
this.Loaded += CheckBoxSubTextControl_Loaded;
}
protected override void OnApplyTemplate()
{
Update();
base.OnApplyTemplate();
}
private void Update()
{
if (!string.IsNullOrEmpty(Header))
{
AutomationProperties.SetName(this, Header);
}
}
private void CheckBoxSubTextControl_Loaded(object sender, RoutedEventArgs e)
{
StackPanel panel = new StackPanel() { Orientation = Orientation.Vertical };
panel.Children.Add(new TextBlock() { Text = Header, TextWrapping = TextWrapping.WrapWholeWords });
// Add text box only if the description is not empty. Required for additional plugin options.
if (!string.IsNullOrWhiteSpace(Description))
{
panel.Children.Add(new IsEnabledTextBlock() { Style = (Style)App.Current.Resources["SecondaryIsEnabledTextBlockStyle"], Text = Description });
}
_checkBoxSubTextControl.Content = panel;
}
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
"Header",
typeof(string),
typeof(CheckBoxWithDescriptionControl),
new PropertyMetadata(default(string)));
public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(
"Description",
typeof(string),
typeof(CheckBoxWithDescriptionControl),
new PropertyMetadata(default(string)));
[Localizable(true)]
public string Header
{
get => (string)GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
[Localizable(true)]
public string Description
{
get => (string)GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value);
}
}

View File

@@ -205,7 +205,7 @@
TextWrapping="NoWrap" />
<StackPanel Orientation="Horizontal" Spacing="4">
<Border Padding="4,2,4,2" Style="{StaticResource HotkeyStyle}">
<TextBlock Style="{StaticResource HotkeyTextBlockStyle}" Text="Ctrl" />
<TextBlock x:Uid="CommandBar_SecondaryButton_HotkeyCtrl" Style="{StaticResource HotkeyTextBlockStyle}" />
</Border>
<Border Style="{StaticResource HotkeyStyle}">
<FontIcon Glyph="&#xE751;" Style="{StaticResource HotkeyFontIconStyle}" />
@@ -220,21 +220,20 @@
AutomationProperties.AutomationId="MoreContextMenuButton"
Click="MoreCommandsButton_Clicked"
Style="{StaticResource SubtleButtonStyle}"
ToolTipService.ToolTip="Ctrl+K"
Visibility="{x:Bind ViewModel.ShouldShowContextMenu, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock
x:Uid="MoreCommandsButton_Label"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
Text="More"
TextTrimming="WordEllipsis"
TextWrapping="NoWrap" />
<StackPanel Orientation="Horizontal" Spacing="4">
<Border Padding="4,2,4,2" Style="{StaticResource HotkeyStyle}">
<TextBlock Style="{StaticResource HotkeyTextBlockStyle}" Text="Ctrl" />
<TextBlock x:Uid="CommandBar_MoreCommandsButtonButton_HotkeyCtrl" Style="{StaticResource HotkeyTextBlockStyle}" />
</Border>
<Border Padding="4,2,4,2" Style="{StaticResource HotkeyStyle}">
<TextBlock Style="{StaticResource HotkeyTextBlockStyle}" Text="K" />
<TextBlock x:Uid="CommandBar_MoreCommandsButtonButton_HotkeyCtrl2" Style="{StaticResource HotkeyTextBlockStyle}" />
</Border>
</StackPanel>
</StackPanel>

View File

@@ -1,43 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.CmdPal.UI.Controls">
<Style x:Key="DefaultIsEnabledTextBlockStyle" TargetType="controls:IsEnabledTextBlock">
<Setter Property="Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:IsEnabledTextBlock">
<Grid>
<TextBlock
x:Name="Label"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Text}"
TextWrapping="WrapWholeWords" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="Label.Foreground" Value="{ThemeResource TextFillColorDisabledBrush}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="SecondaryIsEnabledTextBlockStyle"
BasedOn="{StaticResource DefaultIsEnabledTextBlockStyle}"
TargetType="controls:IsEnabledTextBlock">
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}" />
<Setter Property="FontSize" Value="12" />
</Style>
</ResourceDictionary>

View File

@@ -1,51 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.CmdPal.UI.Controls;
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
public partial class IsEnabledTextBlock : Control
{
public IsEnabledTextBlock()
{
this.Style = (Style)App.Current.Resources["DefaultIsEnabledTextBlockStyle"];
}
protected override void OnApplyTemplate()
{
IsEnabledChanged -= IsEnabledTextBlock_IsEnabledChanged;
SetEnabledState();
IsEnabledChanged += IsEnabledTextBlock_IsEnabledChanged;
base.OnApplyTemplate();
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text",
typeof(string),
typeof(IsEnabledTextBlock),
null);
[Localizable(true)]
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
private void IsEnabledTextBlock_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SetEnabledState();
}
private void SetEnabledState()
{
VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true);
}
}

View File

@@ -1,178 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
using Windows.System;
namespace Microsoft.CmdPal.UI.Controls;
[TemplatePart(Name = KeyPresenter, Type = typeof(ContentPresenter))]
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Default", GroupName = "StateStates")]
[TemplateVisualState(Name = "Error", GroupName = "StateStates")]
public sealed partial class KeyVisual : Control
{
private const string KeyPresenter = "KeyPresenter";
private KeyVisual? _keyVisual;
private ContentPresenter _keyPresenter = new();
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string), OnContentChanged));
public VisualType VisualType
{
get => (VisualType)GetValue(VisualTypeProperty);
set => SetValue(VisualTypeProperty, value);
}
public static readonly DependencyProperty VisualTypeProperty = DependencyProperty.Register("VisualType", typeof(VisualType), typeof(KeyVisual), new PropertyMetadata(default(VisualType), OnSizeChanged));
public bool IsError
{
get => (bool)GetValue(IsErrorProperty);
set => SetValue(IsErrorProperty, value);
}
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnIsErrorChanged));
public KeyVisual()
{
this.DefaultStyleKey = typeof(KeyVisual);
this.Style = GetStyleSize("TextKeyVisualStyle");
}
protected override void OnApplyTemplate()
{
IsEnabledChanged -= KeyVisual_IsEnabledChanged;
_keyVisual = this;
_keyPresenter = (ContentPresenter)_keyVisual.GetTemplateChild(KeyPresenter);
Update();
SetEnabledState();
SetErrorState();
IsEnabledChanged += KeyVisual_IsEnabledChanged;
base.OnApplyTemplate();
}
private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((KeyVisual)d).Update();
}
private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((KeyVisual)d).Update();
}
private static void OnIsErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((KeyVisual)d).SetErrorState();
}
private void Update()
{
if (_keyVisual is null)
{
return;
}
if (_keyVisual.Content is not null)
{
if (_keyVisual.Content.GetType() == typeof(string))
{
_keyVisual.Style = GetStyleSize("TextKeyVisualStyle");
_keyVisual._keyPresenter.Content = _keyVisual.Content;
}
else
{
_keyVisual.Style = GetStyleSize("IconKeyVisualStyle");
switch ((int)_keyVisual.Content)
{
/* We can enable other glyphs in the future
case 13: // The Enter key or button.
_keyVisual._keyPresenter.Content = "\uE751"; break;
case 8: // The Back key or button.
_keyVisual._keyPresenter.Content = "\uE750"; break;
case 16: // The right Shift key or button.
case 160: // The left Shift key or button.
case 161: // The Shift key or button.
_keyVisual._keyPresenter.Content = "\uE752"; break; */
case 38: _keyVisual._keyPresenter.Content = "\uE0E4"; break; // The Up Arrow key or button.
case 40: _keyVisual._keyPresenter.Content = "\uE0E5"; break; // The Down Arrow key or button.
case 37: _keyVisual._keyPresenter.Content = "\uE0E2"; break; // The Left Arrow key or button.
case 39: _keyVisual._keyPresenter.Content = "\uE0E3"; break; // The Right Arrow key or button.
case 91: // The left Windows key
case 92: // The right Windows key
var winIcon = XamlReader.Load(@"<PathIcon xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" Data=""M683 1229H0V546h683v683zm819 0H819V546h683v683zm-819 819H0v-683h683v683zm819 0H819v-683h683v683z"" />") as PathIcon;
var winIconContainer = new Viewbox
{
Child = winIcon,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
};
var iconDimensions = GetIconSize();
winIconContainer.Height = iconDimensions;
winIconContainer.Width = iconDimensions;
_keyVisual._keyPresenter.Content = winIconContainer;
break;
default: _keyVisual._keyPresenter.Content = ((VirtualKey)_keyVisual.Content).ToString(); break;
}
}
}
}
public Style GetStyleSize(string styleName)
{
return VisualType == VisualType.Small
? (Style)App.Current.Resources["Small" + styleName]
: VisualType == VisualType.SmallOutline
? (Style)App.Current.Resources["SmallOutline" + styleName]
: VisualType == VisualType.TextOnly
? (Style)App.Current.Resources["Only" + styleName]
: (Style)App.Current.Resources["Default" + styleName];
}
public double GetIconSize()
{
return VisualType == VisualType.Small || VisualType == VisualType.SmallOutline
? (double)App.Current.Resources["SmallIconSize"]
: (double)App.Current.Resources["DefaultIconSize"];
}
private void KeyVisual_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SetEnabledState();
}
private void SetErrorState()
{
VisualStateManager.GoToState(this, IsError ? "Error" : "Default", true);
}
private void SetEnabledState()
{
VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true);
}
}
public enum VisualType
{
Small,
SmallOutline,
TextOnly,
Large,
}

View File

@@ -1,174 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.CmdPal.UI.Controls">
<x:Double x:Key="DefaultIconSize">16</x:Double>
<x:Double x:Key="SmallIconSize">12</x:Double>
<Style x:Key="DefaultTextKeyVisualStyle" TargetType="controls:KeyVisual">
<Setter Property="MinWidth" Value="56" />
<Setter Property="MinHeight" Value="48" />
<Setter Property="Background" Value="{ThemeResource AccentButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource AccentButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource AccentButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
<Setter Property="Padding" Value="16,8,16,8" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:KeyVisual">
<Grid>
<Grid>
<Rectangle
x:Name="ContentHolder"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
Fill="{TemplateBinding Background}"
RadiusX="4"
RadiusY="4"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}" />
<ContentPresenter
x:Name="KeyPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}" />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="ContentHolder.Fill" Value="{ThemeResource AccentButtonBackgroundDisabled}" />
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource AccentButtonForegroundDisabled}" />
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource AccentButtonBorderBrushDisabled}" />
<!--<Setter Target="ContentHolder.StrokeThickness" Value="{TemplateBinding BorderThickness}" />-->
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="StateStates">
<VisualState x:Name="Default" />
<VisualState x:Name="Error">
<VisualState.Setters>
<Setter Target="ContentHolder.Fill" Value="{ThemeResource InfoBarErrorSeverityBackgroundBrush}" />
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
<Setter Target="ContentHolder.StrokeThickness" Value="2" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style
x:Key="SmallTextKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Height" Value="36" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="12,0,12,2" />
<Setter Property="FontSize" Value="14" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style
x:Key="SmallOutlineTextKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="Height" Value="36" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="8,0,8,2" />
<Setter Property="FontSize" Value="13" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style
x:Key="DefaultIconKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinWidth" Value="56" />
<Setter Property="MinHeight" Value="48" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="Padding" Value="16,8,16,8" />
<Setter Property="FontSize" Value="14" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style
x:Key="SmallIconKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Height" Value="36" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="10" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style
x:Key="SmallOutlineIconKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinWidth" Value="40" />
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="Height" Value="36" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="9" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style
x:Key="OnlyTextKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinHeight" Value="12" />
<Setter Property="MinWidth" Value="12" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="0" />
<Setter Property="FontSize" Value="12" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<Style
x:Key="OnlyIconKeyVisualStyle"
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
TargetType="controls:KeyVisual">
<Setter Property="MinHeight" Value="10" />
<Setter Property="MinWidth" Value="10" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="0,0,0,3" />
<!--<Setter Property="FontSize" Value="9" />-->
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</ResourceDictionary>

View File

@@ -5,49 +5,90 @@
xmlns:controls="using:Microsoft.CmdPal.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
x:Name="LayoutRoot"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<Grid HorizontalAlignment="Right">
<StackPanel Orientation="Horizontal">
<Button
x:Name="EditButton"
Padding="0"
Click="OpenDialogButton_Click"
CornerRadius="8">
<Button
x:Name="EditButton"
Padding="0"
HorizontalAlignment="Right"
Click="OpenDialogButton_Click"
Style="{StaticResource SubtleButtonStyle}">
<StackPanel Orientation="Horizontal" Spacing="4">
<ItemsControl
x:Name="PreviewKeysControl"
Margin="2"
VerticalAlignment="Center"
IsEnabled="{Binding ElementName=EditButton, Path=IsEnabled}"
IsTabStop="False"
Visibility="Collapsed">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<ptcontrols:KeyVisual
MinWidth="36"
Padding="8,8,8,8"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"
CornerRadius="{StaticResource ControlCornerRadius}"
IsTabStop="False"
Style="{StaticResource AccentKeyVisualStyle}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<StackPanel
Margin="12,6,12,6"
x:Name="PlaceholderPanel"
Padding="8,4"
BorderBrush="{ThemeResource ControlStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="{StaticResource ControlCornerRadius}"
Orientation="Horizontal"
Spacing="16">
<ItemsControl
x:Name="PreviewKeysControl"
Spacing="8">
<ptcontrols:IsEnabledTextBlock
VerticalAlignment="Center"
IsEnabled="{Binding ElementName=EditButton, Path=IsEnabled}"
IsTabStop="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"
IsTabStop="False"
VisualType="Small" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<FontIcon
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Glyph="&#xE70F;" />
FontFamily="Segoe Fluent Icons"
FontSize="12"
Text="&#xE710;" />
<ptcontrols:IsEnabledTextBlock
x:Uid="ConfigureShortcutText"
Margin="0,-1,0,0"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
</StackPanel>
</Button>
</StackPanel>
<ptcontrols:IsEnabledTextBlock
x:Name="EditIcon"
Margin="0,0,4,0"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
AutomationProperties.Name=""
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="&#xE70F;"
Visibility="Collapsed" />
</StackPanel>
</Button>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Configured">
<VisualState.Setters>
<Setter Target="PlaceholderPanel.Visibility" Value="Collapsed" />
<Setter Target="PreviewKeysControl.Visibility" Value="Visible" />
<Setter Target="EditIcon.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

View File

@@ -11,6 +11,7 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.Windows.ApplicationModel.Resources;
using Windows.System;
namespace Microsoft.CmdPal.UI.Controls;
@@ -36,6 +37,8 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
public static readonly DependencyProperty AllowDisableProperty = DependencyProperty.Register("AllowDisable", typeof(bool), typeof(ShortcutControl), new PropertyMetadata(false, OnAllowDisableChanged));
private static ResourceLoader resourceLoader = Microsoft.CmdPal.UI.Helpers.ResourceLoaderInstance.ResourceLoader;
private static void OnAllowDisableChanged(DependencyObject d, DependencyPropertyChangedEventArgs? e)
{
var me = d as ShortcutControl;
@@ -96,8 +99,7 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
{
hotkeySettings = value;
SetValue(HotkeySettingsProperty, value);
PreviewKeysControl.ItemsSource = HotkeySettings?.GetKeysList() ?? new List<object>();
AutomationProperties.SetHelpText(EditButton, HotkeySettings?.ToString() ?? string.Empty);
SetKeys();
c.Keys = HotkeySettings?.GetKeysList() ?? new List<object>();
}
}
@@ -108,8 +110,6 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
InitializeComponent();
internalSettings = new HotkeySettings();
var resourceLoader = Microsoft.CmdPal.UI.Helpers.ResourceLoaderInstance.ResourceLoader;
// We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme.
shortcutDialog = new ContentDialog
{
@@ -421,11 +421,9 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
hotkeySettings = null;
SetValue(HotkeySettingsProperty, hotkeySettings);
PreviewKeysControl.ItemsSource = HotkeySettings?.GetKeysList() ?? new List<object>();
SetKeys();
lastValidSettings = hotkeySettings;
AutomationProperties.SetHelpText(EditButton, HotkeySettings?.ToString() ?? string.Empty);
shortcutDialog.Hide();
}
@@ -436,8 +434,7 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
HotkeySettings = lastValidSettings with { };
}
PreviewKeysControl.ItemsSource = hotkeySettings?.GetKeysList() ?? new List<object>();
AutomationProperties.SetHelpText(EditButton, HotkeySettings?.ToString() ?? string.Empty);
SetKeys();
shortcutDialog.Hide();
}
@@ -450,9 +447,7 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
var empty = new HotkeySettings();
HotkeySettings = empty;
PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList();
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
SetKeys();
shortcutDialog.Hide();
}
@@ -508,4 +503,23 @@ public sealed partial class ShortcutControl : UserControl, IDisposable, IRecipie
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
private void SetKeys()
{
var keys = HotkeySettings?.GetKeysList();
if (keys != null && keys.Count > 0)
{
VisualStateManager.GoToState(this, "Configured", true);
PreviewKeysControl.ItemsSource = keys;
#pragma warning disable CS8602 // Dereference of a possibly null reference.
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
#pragma warning restore CS8602 // Dereference of a possibly null reference.
}
else
{
VisualStateManager.GoToState(this, "Normal", true);
AutomationProperties.SetHelpText(EditButton, resourceLoader.GetString("ConfigureShortcut"));
}
}
}

View File

@@ -2,12 +2,16 @@
x:Class="Microsoft.CmdPal.UI.Controls.ShortcutDialogContentControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.CmdPal.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
x:Name="ShortcutContentControl"
mc:Ignorable="d">
<UserControl.Resources>
<converters:BoolToKeyVisualStateConverter x:Key="BoolToKeyVisualStateConverter" />
</UserControl.Resources>
<Grid MinWidth="498" MinHeight="220">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -33,13 +37,16 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
Height="56"
<ptcontrols:KeyVisual
Padding="20,16"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"
IsError="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
CornerRadius="{StaticResource OverlayCornerRadius}"
FontSize="16"
FontWeight="SemiBold"
IsTabStop="False"
VisualType="Large" />
State="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay, Converter={StaticResource BoolToKeyVisualStateConverter}, ConverterParameter=Error}"
Style="{StaticResource AccentKeyVisualStyle}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

View File

@@ -1,45 +0,0 @@
<UserControl
x:Class="Microsoft.CmdPal.UI.Controls.ShortcutWithTextLabelControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.CmdPal.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">
<Grid ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ItemsControl
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
IsTabStop="False"
ItemsSource="{x:Bind Keys}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"
IsTabStop="False"
VisualType="SmallOutline" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<tkcontrols:MarkdownTextBlock
Grid.Column="1"
VerticalAlignment="Center"
Background="Transparent"
Text="{x:Bind Text}" />
</Grid>
</UserControl>

View File

@@ -1,35 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Microsoft.CmdPal.UI.Controls
{
public sealed partial class ShortcutWithTextLabelControl : UserControl
{
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(ShortcutWithTextLabelControl), new PropertyMetadata(default(string)));
public List<object> Keys
{
get { return (List<object>)GetValue(KeysProperty); }
set { SetValue(KeysProperty, value); }
}
public static readonly DependencyProperty KeysProperty = DependencyProperty.Register("Keys", typeof(List<object>), typeof(ShortcutWithTextLabelControl), new PropertyMetadata(default(string)));
public ShortcutWithTextLabelControl()
{
this.InitializeComponent();
}
}
}

View File

@@ -72,10 +72,8 @@
<None Remove="Controls\CommandPalettePreview.xaml" />
<None Remove="Controls\DevRibbon.xaml" />
<None Remove="Controls\FallbackRankerDialog.xaml" />
<None Remove="Controls\KeyVisual\KeyCharPresenter.xaml" />
<None Remove="Controls\ScreenPreview.xaml" />
<None Remove="Controls\SearchBar.xaml" />
<None Remove="IsEnabledTextBlock.xaml" />
<None Remove="ListDetailPage.xaml" />
<None Remove="LoadingPage.xaml" />
<None Remove="MainPage.xaml" />
@@ -128,6 +126,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
<ProjectReference Include="..\..\..\common\Common.UI.Controls\Common.UI.Controls.csproj" />
<ProjectReference Include="..\ext\Microsoft.CmdPal.Ext.ClipboardHistory\Microsoft.CmdPal.Ext.ClipboardHistory.csproj" />
<ProjectReference Include="..\ext\Microsoft.CmdPal.Ext.RemoteDesktop\Microsoft.CmdPal.Ext.RemoteDesktop.csproj" />
<ProjectReference Include="..\ext\Microsoft.CmdPal.Ext.System\Microsoft.CmdPal.Ext.System.csproj" />
@@ -255,17 +254,6 @@
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="IsEnabledTextBlock.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Controls\KeyVisual\KeyCharPresenter.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Page Update="Settings\InternalPage.xaml">
<Generator>MSBuild:Compile</Generator>

View File

@@ -11,6 +11,7 @@
xmlns:helpers="using:Microsoft.CmdPal.UI.Helpers"
xmlns:local="using:Microsoft.CmdPal.UI.Settings"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:viewModels="using:Microsoft.CmdPal.UI.ViewModels"
mc:Ignorable="d">
@@ -174,7 +175,7 @@
<controls:SettingsExpander.Items>
<controls:SettingsCard ContentAlignment="Left">
<cpcontrols:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
x:Uid="Settings_FallbacksPage_GlobalResults_SettingsCard"
IsChecked="{x:Bind IncludeInGlobalResults, Mode=TwoWay}"
IsEnabled="{x:Bind IsEnabled, Mode=OneWay}" />

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="Microsoft.CmdPal.UI.Settings.GeneralPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@@ -9,6 +9,7 @@
xmlns:local="using:Microsoft.CmdPal.UI.Settings"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptControls="using:Microsoft.CmdPal.UI.Controls"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:viewModels="using:Microsoft.CmdPal.UI.ViewModels"
mc:Ignorable="d">
@@ -44,10 +45,10 @@
<ptControls:ShortcutControl HotkeySettings="{x:Bind viewModel.Hotkey, Mode=TwoWay}" />
<controls:SettingsExpander.Items>
<controls:SettingsCard ContentAlignment="Left">
<ptControls:CheckBoxWithDescriptionControl x:Uid="Settings_GeneralPage_LowLevelHook_SettingsCard" IsChecked="{x:Bind viewModel.UseLowLevelGlobalHotkey, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="Settings_GeneralPage_LowLevelHook_SettingsCard" IsChecked="{x:Bind viewModel.UseLowLevelGlobalHotkey, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard ContentAlignment="Left">
<ptControls:CheckBoxWithDescriptionControl x:Uid="Settings_GeneralPage_IgnoreShortcutWhenFullscreen_SettingsCard" IsChecked="{x:Bind viewModel.IgnoreShortcutWhenFullscreen, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="Settings_GeneralPage_IgnoreShortcutWhenFullscreen_SettingsCard" IsChecked="{x:Bind viewModel.IgnoreShortcutWhenFullscreen, Mode=TwoWay}" />
</controls:SettingsCard>
</controls:SettingsExpander.Items>
</controls:SettingsExpander>

View File

@@ -777,4 +777,22 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
<data name="Settings_ExtensionsPage_More_Button.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>More options</value>
</data>
<data name="MoreCommandsButton_Label.Text" xml:space="preserve">
<value>More</value>
</data>
<data name="CommandBar_SecondaryButton_HotkeyCtrl.Text" xml:space="preserve">
<value>Ctrl</value>
<comment>Key modifier</comment>
</data>
<data name="CommandBar_MoreCommandsButtonButton_HotkeyCtrl.Text" xml:space="preserve">
<value>Ctrl</value>
<comment>Key modifier</comment>
</data>
<data name="MoreCommandsButton.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>Ctrl+K</value>
</data>
<data name="CommandBar_MoreCommandsButtonButton_HotkeyCtrl2.Text" xml:space="preserve">
<value>K</value>
<comment>Keyboard key</comment>
</data>
</root>

View File

@@ -1,7 +1,7 @@
---
author: Mike Griese
created on: 2024-07-19
last updated: 2025-08-08
last updated: 2026-02-05
issue id: n/a
---
@@ -75,6 +75,8 @@ functionality.
- [Advanced scenarios](#advanced-scenarios)
- [Status messages](#status-messages)
- [Rendering of ICommandItems in Lists and Menus](#rendering-of-icommanditems-in-lists-and-menus)
- [Addenda I: API additions (ICommandProvider2)](#addenda-i-api-additions-icommandprovider2)
- [Addenda IV: Dock bands](#addenda-iv-dock-bands)
- [Class diagram](#class-diagram)
- [Future considerations](#future-considerations)
- [Arbitrary parameters and arguments](#arbitrary-parameters-and-arguments)
@@ -2045,6 +2047,87 @@ Fortunately, we can put all of that (`GetApiExtensionStubs`,
developers won't have to do anything. The toolkit will just do the right thing
for them.
## Addenda IV: Dock bands
The "dock" is another way to surface commands to the user. This is a
toolbar-like window that can be docked to the side of the screen, or floated as
its own window. It enables another surface for extensions to display real-time
information and shortcuts to users.
Bands are powered by the same interfaces as DevPal itself. Extensions can provide
bands via the new `DockBand` property on `ICommandProvider3`.
```csharp
interface ICommandProvider3 requires ICommandProvider2
{
ICommandItem[] GetDockBands();
};
```
A **Dock Band** is one "strip of items" in the dock. Each band can have multiple
items. This allows an extension to create a strip of buttons that should all be
treated as a single unit. For example, a media player band will want probably
four items:
* one for the previous track
* one for play/pause
* one for next track
* and one to display the album art and track title
`GetDockBands` returns an array of `ICommandItem`s. Each `ICommandItem`
represents one band in the dock. These represent all of the bands that an
extension would allow the user to add to their dock.
All of the `ICommandItem`s returned from `GetDockBands` **must** have a
`Command` with a non-empty `Id` set. If the `Id` is null or empty, DevPal will
ignore that band.
Bands are not automatically added to the dock. Instead, the user must choose
which bands they want to add. This is done via the DevPal settings page.
Furthermore, bands are not displayed in the list of commands in DevPal itself.
This allows extension authors to create objects that are only intended for the
dock, without cluttering up the main DevPal UI, and vice versa.
DevPal will then create UI in the dock for each band the user has chosen to add.
What that looks like will depend on the `Command` in the `ICommandItem`:
* A `IInvokableCommand` will be rendered as a single button. Think "the
time/date" button on the taskbar, that opens the notification center.
* A `IListPage` will be rendered as a strip of buttons, one for each `IListItem`
in the list. Think "media controls" for a music player.
* A `IContentPage` will be rendered as a single button. Clicking that button
will open a flyout with that content rendered in it. Think "weather" or "news"
flyouts.
If the `Command` in the `IListItem`s of a band are pages, then clicking those
buttons will open DevPal to that page, as if it were a flyout from the dock.
The `.Title` property of the top-level `ICommandItem` representing the band will
be used as the name of the band in the settings. So a media player band might
want to set the `Title` to "Contoso Music Player", even if the individual
buttons in the band don't show that title.
Users may also "pin" a top-level command from DevPal into the dock. DevPal will
take care of creating a new band (owned by devpal) with that command in it. This
allows users to add quick shortcuts to their favorite commands in the dock.
Think: pinning an app, or pinning a particular GitHub query.
Bands are added via ID. An extension may choose to have a TopLevelCommand and a
DockBand with the same `Id`. In this case, if the user pins the TopLevelCommand
to the dock, DevPal will pin the band from `GetDockBands`, rather than creating
a simple pinned command. This allows extension authors to seamlessly have a
top-level command present a palette-specific experience, while also having a
dock-specific experience. In our ongoing media player example, the top-level
command might open DevPal to a full-featured music control page, while the dock
band has simpler buttons on it (without a title/subtitle).
Users may choose to have:
* the orientation of the dock: vertical or horizontal
* the size of the dock
* which bands are shown in the dock
* whether the "labels" (read: `Title` & `Subtitle`) of individual bands are
shown or hidden.
- Dock bands will still display the `Title` & `Subtitle` of each item in the
band as the tooltip on those items, even when the "labels" are hidden.
## Class diagram
This is a diagram attempting to show the relationships between the various types we've defined for the SDK. Some elements are omitted for clarity. (Notably, `IconData` and `IPropChanged`, which are used in many places.)

View File

@@ -6,13 +6,14 @@ using System;
using System.Collections.Generic;
using ManagedCommon;
using Microsoft.CmdPal.Ext.ClipboardHistory.Models;
using Microsoft.CmdPal.Ext.ClipboardHistory.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.ClipboardHistory.Helpers.Analyzers;
internal sealed class ImageMetadataProvider : IClipboardMetadataProvider
{
public string SectionTitle => "Image metadata";
public string SectionTitle => Resources.metadata_image_section_title;
public bool CanHandle(ClipboardItem item) => item.IsImage;
@@ -30,12 +31,12 @@ internal sealed class ImageMetadataProvider : IClipboardMetadataProvider
result.Add(new DetailsElement
{
Key = "Dimensions",
Key = Resources.metadata_image_dimensions_key,
Data = new DetailsLink($"{metadata.Width} x {metadata.Height}"),
});
result.Add(new DetailsElement
{
Key = "DPI",
Key = Resources.metadata_image_dpi_key,
Data = new DetailsLink($"{metadata.DpiX:0.###} x {metadata.DpiY:0.###}"),
});
@@ -43,7 +44,7 @@ internal sealed class ImageMetadataProvider : IClipboardMetadataProvider
{
result.Add(new DetailsElement
{
Key = "Storage size",
Key = Resources.metadata_image_storage_size_key,
Data = new DetailsLink(SizeFormatter.FormatSize(metadata.StorageSize.Value)),
});
}

View File

@@ -9,6 +9,7 @@ using System.IO;
using ManagedCommon;
using Microsoft.CmdPal.Core.Common.Helpers;
using Microsoft.CmdPal.Ext.ClipboardHistory.Models;
using Microsoft.CmdPal.Ext.ClipboardHistory.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.ClipboardHistory.Helpers.Analyzers;
@@ -18,7 +19,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Helpers.Analyzers;
/// </summary>
internal sealed class TextFileSystemMetadataProvider : IClipboardMetadataProvider
{
public string SectionTitle => "File";
public string SectionTitle => Resources.metadata_file_system_section_title;
public bool CanHandle(ClipboardItem item)
{
@@ -47,8 +48,8 @@ internal sealed class TextFileSystemMetadataProvider : IClipboardMetadataProvide
if (PathHelper.IsSlow(path) || !PathHelper.Exists(path, out var isDirectory))
{
result.Add(new DetailsElement { Key = "Name", Data = new DetailsLink(Path.GetFileName(path)) });
result.Add(new DetailsElement { Key = "Location", Data = new DetailsLink(UrlHelper.NormalizeUrl(path), path) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_name_key, Data = new DetailsLink(Path.GetFileName(path)) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_location_key, Data = new DetailsLink(UrlHelper.NormalizeUrl(path), path) });
return result;
}
@@ -57,21 +58,21 @@ internal sealed class TextFileSystemMetadataProvider : IClipboardMetadataProvide
if (!isDirectory)
{
var fi = new FileInfo(path);
result.Add(new DetailsElement { Key = "Name", Data = new DetailsLink(fi.Name) });
result.Add(new DetailsElement { Key = "Location", Data = new DetailsLink(UrlHelper.NormalizeUrl(fi.FullName), fi.FullName) });
result.Add(new DetailsElement { Key = "Type", Data = new DetailsLink(fi.Extension) });
result.Add(new DetailsElement { Key = "Size", Data = new DetailsLink(SizeFormatter.FormatSize(fi.Length)) });
result.Add(new DetailsElement { Key = "Modified", Data = new DetailsLink(fi.LastWriteTime.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = "Created", Data = new DetailsLink(fi.CreationTime.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_name_key, Data = new DetailsLink(fi.Name) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_location_key, Data = new DetailsLink(UrlHelper.NormalizeUrl(fi.FullName), fi.FullName) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_type_key, Data = new DetailsLink(fi.Extension) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_size_key, Data = new DetailsLink(SizeFormatter.FormatSize(fi.Length)) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_modified_key, Data = new DetailsLink(fi.LastWriteTime.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_created_key, Data = new DetailsLink(fi.CreationTime.ToString(CultureInfo.CurrentCulture)) });
}
else
{
var di = new DirectoryInfo(path);
result.Add(new DetailsElement { Key = "Name", Data = new DetailsLink(di.Name) });
result.Add(new DetailsElement { Key = "Location", Data = new DetailsLink(UrlHelper.NormalizeUrl(di.FullName), di.FullName) });
result.Add(new DetailsElement { Key = "Type", Data = new DetailsLink("Folder") });
result.Add(new DetailsElement { Key = "Modified", Data = new DetailsLink(di.LastWriteTime.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = "Created", Data = new DetailsLink(di.CreationTime.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_name_key, Data = new DetailsLink(di.Name) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_location_key, Data = new DetailsLink(UrlHelper.NormalizeUrl(di.FullName), di.FullName) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_type_key, Data = new DetailsLink(Resources.metadata_file_system_folder_value) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_modified_key, Data = new DetailsLink(di.LastWriteTime.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = Resources.metadata_file_system_created_key, Data = new DetailsLink(di.CreationTime.ToString(CultureInfo.CurrentCulture)) });
}
}
catch (Exception ex)

View File

@@ -5,13 +5,14 @@
using System.Collections.Generic;
using System.Globalization;
using Microsoft.CmdPal.Ext.ClipboardHistory.Models;
using Microsoft.CmdPal.Ext.ClipboardHistory.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.ClipboardHistory.Helpers.Analyzers;
internal sealed class TextMetadataProvider : IClipboardMetadataProvider
{
public string SectionTitle => "Text statistics";
public string SectionTitle => Resources.metadata_text_section_title;
public bool CanHandle(ClipboardItem item) => item.IsText;
@@ -27,32 +28,32 @@ internal sealed class TextMetadataProvider : IClipboardMetadataProvider
result.Add(new DetailsElement
{
Key = "Characters",
Key = Resources.metadata_text_characters_key,
Data = new DetailsLink(r.CharacterCount.ToString(CultureInfo.CurrentCulture)),
});
result.Add(new DetailsElement
{
Key = "Words",
Key = Resources.metadata_text_words_key,
Data = new DetailsLink(r.WordCount.ToString(CultureInfo.CurrentCulture)),
});
result.Add(new DetailsElement
{
Key = "Sentences",
Key = Resources.metadata_text_sentences_key,
Data = new DetailsLink(r.SentenceCount.ToString(CultureInfo.CurrentCulture)),
});
result.Add(new DetailsElement
{
Key = "Lines",
Key = Resources.metadata_text_lines_key,
Data = new DetailsLink(r.LineCount.ToString(CultureInfo.CurrentCulture)),
});
result.Add(new DetailsElement
{
Key = "Paragraphs",
Key = Resources.metadata_text_paragraphs_key,
Data = new DetailsLink(r.ParagraphCount.ToString(CultureInfo.CurrentCulture)),
});
result.Add(new DetailsElement
{
Key = "Line Ending",
Key = Resources.metadata_text_line_ending_key,
Data = new DetailsLink(r.LineEnding.ToString()),
});

View File

@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Microsoft.CmdPal.Ext.ClipboardHistory.Models;
using Microsoft.CmdPal.Ext.ClipboardHistory.Properties;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace Microsoft.CmdPal.Ext.ClipboardHistory.Helpers.Analyzers;
@@ -16,7 +17,7 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Helpers.Analyzers;
/// </summary>
internal sealed class WebLinkMetadataProvider : IClipboardMetadataProvider
{
public string SectionTitle => "Link";
public string SectionTitle => Resources.metadata_web_link_section_title;
public bool CanHandle(ClipboardItem item)
{
@@ -62,29 +63,29 @@ internal sealed class WebLinkMetadataProvider : IClipboardMetadataProvider
return result;
}
result.Add(new DetailsElement { Key = "URL", Data = new DetailsLink(normalized) });
result.Add(new DetailsElement { Key = "Host", Data = new DetailsLink(uri.Host) });
result.Add(new DetailsElement { Key = Resources.metadata_web_link_url_key, Data = new DetailsLink(normalized) });
result.Add(new DetailsElement { Key = Resources.metadata_web_link_host_key, Data = new DetailsLink(uri.Host) });
if (!uri.IsDefaultPort)
{
result.Add(new DetailsElement { Key = "Port", Data = new DetailsLink(uri.Port.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = Resources.metadata_web_link_port_key, Data = new DetailsLink(uri.Port.ToString(CultureInfo.CurrentCulture)) });
}
if (!string.IsNullOrEmpty(uri.AbsolutePath) && uri.AbsolutePath != "/")
{
result.Add(new DetailsElement { Key = "Path", Data = new DetailsLink(uri.AbsolutePath) });
result.Add(new DetailsElement { Key = Resources.metadata_web_link_path_key, Data = new DetailsLink(uri.AbsolutePath) });
}
if (!string.IsNullOrEmpty(uri.Query))
{
var q = uri.Query;
var count = q.Count(static c => c == '&') + (q.Length > 1 ? 1 : 0);
result.Add(new DetailsElement { Key = "Query params", Data = new DetailsLink(count.ToString(CultureInfo.CurrentCulture)) });
result.Add(new DetailsElement { Key = Resources.metadata_web_link_query_params_key, Data = new DetailsLink(count.ToString(CultureInfo.CurrentCulture)) });
}
if (!string.IsNullOrEmpty(uri.Fragment))
{
result.Add(new DetailsElement { Key = "Fragment", Data = new DetailsLink(uri.Fragment) });
result.Add(new DetailsElement { Key = Resources.metadata_web_link_fragment_key, Data = new DetailsLink(uri.Fragment) });
}
}
catch

View File

@@ -68,7 +68,7 @@ internal sealed partial class ClipboardListItem : ListItem
if (item.IsImage)
{
Title = "Image";
Title = Properties.Resources.clipboard_item_image_title;
_pasteCommand = new CommandContextItem(new PasteCommand(_item, ClipboardFormat.Image, _settingsManager));
_copyCommand = new CommandContextItem(new CopyCommand(_item, ClipboardFormat.Image));
@@ -220,12 +220,12 @@ internal sealed partial class ClipboardListItem : ListItem
metadata.Add(new DetailsElement
{
Key = "General",
Key = Properties.Resources.metadata_general_section_title,
Data = new DetailsSeparator(),
});
metadata.Add(new DetailsElement
{
Key = "Copied",
Key = Properties.Resources.metadata_copied_key,
Data = new DetailsLink(_item.Timestamp.DateTime.ToString(DateTimeFormatInfo.CurrentInfo)),
});

View File

@@ -78,6 +78,15 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Image.
/// </summary>
public static string clipboard_item_image_title {
get {
return ResourceManager.GetString("clipboard_item_image_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copied to clipboard.
/// </summary>
@@ -150,6 +159,258 @@ namespace Microsoft.CmdPal.Ext.ClipboardHistory.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Copied.
/// </summary>
public static string metadata_copied_key {
get {
return ResourceManager.GetString("metadata_copied_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Created.
/// </summary>
public static string metadata_file_system_created_key {
get {
return ResourceManager.GetString("metadata_file_system_created_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Folder.
/// </summary>
public static string metadata_file_system_folder_value {
get {
return ResourceManager.GetString("metadata_file_system_folder_value", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Location.
/// </summary>
public static string metadata_file_system_location_key {
get {
return ResourceManager.GetString("metadata_file_system_location_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Modified.
/// </summary>
public static string metadata_file_system_modified_key {
get {
return ResourceManager.GetString("metadata_file_system_modified_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
public static string metadata_file_system_name_key {
get {
return ResourceManager.GetString("metadata_file_system_name_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to File.
/// </summary>
public static string metadata_file_system_section_title {
get {
return ResourceManager.GetString("metadata_file_system_section_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Size.
/// </summary>
public static string metadata_file_system_size_key {
get {
return ResourceManager.GetString("metadata_file_system_size_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Type.
/// </summary>
public static string metadata_file_system_type_key {
get {
return ResourceManager.GetString("metadata_file_system_type_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to General.
/// </summary>
public static string metadata_general_section_title {
get {
return ResourceManager.GetString("metadata_general_section_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Dimensions.
/// </summary>
public static string metadata_image_dimensions_key {
get {
return ResourceManager.GetString("metadata_image_dimensions_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to DPI.
/// </summary>
public static string metadata_image_dpi_key {
get {
return ResourceManager.GetString("metadata_image_dpi_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Image metadata.
/// </summary>
public static string metadata_image_section_title {
get {
return ResourceManager.GetString("metadata_image_section_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Storage size.
/// </summary>
public static string metadata_image_storage_size_key {
get {
return ResourceManager.GetString("metadata_image_storage_size_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Characters.
/// </summary>
public static string metadata_text_characters_key {
get {
return ResourceManager.GetString("metadata_text_characters_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Line ending.
/// </summary>
public static string metadata_text_line_ending_key {
get {
return ResourceManager.GetString("metadata_text_line_ending_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Lines.
/// </summary>
public static string metadata_text_lines_key {
get {
return ResourceManager.GetString("metadata_text_lines_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Paragraphs.
/// </summary>
public static string metadata_text_paragraphs_key {
get {
return ResourceManager.GetString("metadata_text_paragraphs_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text statistics.
/// </summary>
public static string metadata_text_section_title {
get {
return ResourceManager.GetString("metadata_text_section_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sentences.
/// </summary>
public static string metadata_text_sentences_key {
get {
return ResourceManager.GetString("metadata_text_sentences_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Words.
/// </summary>
public static string metadata_text_words_key {
get {
return ResourceManager.GetString("metadata_text_words_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Fragment.
/// </summary>
public static string metadata_web_link_fragment_key {
get {
return ResourceManager.GetString("metadata_web_link_fragment_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Host.
/// </summary>
public static string metadata_web_link_host_key {
get {
return ResourceManager.GetString("metadata_web_link_host_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Path.
/// </summary>
public static string metadata_web_link_path_key {
get {
return ResourceManager.GetString("metadata_web_link_path_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Port.
/// </summary>
public static string metadata_web_link_port_key {
get {
return ResourceManager.GetString("metadata_web_link_port_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Query params.
/// </summary>
public static string metadata_web_link_query_params_key {
get {
return ResourceManager.GetString("metadata_web_link_query_params_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Web link.
/// </summary>
public static string metadata_web_link_section_title {
get {
return ResourceManager.GetString("metadata_web_link_section_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to URL.
/// </summary>
public static string metadata_web_link_url_key {
get {
return ResourceManager.GetString("metadata_web_link_url_key", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open URL.
/// </summary>

View File

@@ -186,4 +186,91 @@
<data name="open_url_command_name" xml:space="preserve">
<value>Open URL</value>
</data>
<data name="metadata_image_section_title" xml:space="preserve">
<value>Image metadata</value>
</data>
<data name="metadata_image_dimensions_key" xml:space="preserve">
<value>Dimensions</value>
</data>
<data name="metadata_image_dpi_key" xml:space="preserve">
<value>DPI</value>
</data>
<data name="metadata_image_storage_size_key" xml:space="preserve">
<value>Storage size</value>
</data>
<data name="metadata_text_section_title" xml:space="preserve">
<value>Text statistics</value>
</data>
<data name="metadata_text_characters_key" xml:space="preserve">
<value>Characters</value>
</data>
<data name="metadata_text_words_key" xml:space="preserve">
<value>Words</value>
</data>
<data name="metadata_text_sentences_key" xml:space="preserve">
<value>Sentences</value>
</data>
<data name="metadata_text_lines_key" xml:space="preserve">
<value>Lines</value>
</data>
<data name="metadata_text_paragraphs_key" xml:space="preserve">
<value>Paragraphs</value>
</data>
<data name="metadata_text_line_ending_key" xml:space="preserve">
<value>Line ending</value>
</data>
<data name="metadata_file_system_section_title" xml:space="preserve">
<value>File</value>
</data>
<data name="metadata_file_system_name_key" xml:space="preserve">
<value>Name</value>
</data>
<data name="metadata_file_system_location_key" xml:space="preserve">
<value>Location</value>
</data>
<data name="metadata_file_system_type_key" xml:space="preserve">
<value>Type</value>
</data>
<data name="metadata_file_system_size_key" xml:space="preserve">
<value>Size</value>
</data>
<data name="metadata_file_system_modified_key" xml:space="preserve">
<value>Modified</value>
</data>
<data name="metadata_file_system_created_key" xml:space="preserve">
<value>Created</value>
</data>
<data name="metadata_web_link_section_title" xml:space="preserve">
<value>Web link</value>
</data>
<data name="metadata_web_link_url_key" xml:space="preserve">
<value>URL</value>
</data>
<data name="metadata_web_link_host_key" xml:space="preserve">
<value>Host</value>
</data>
<data name="metadata_web_link_port_key" xml:space="preserve">
<value>Port</value>
</data>
<data name="metadata_web_link_path_key" xml:space="preserve">
<value>Path</value>
</data>
<data name="metadata_web_link_query_params_key" xml:space="preserve">
<value>Query params</value>
</data>
<data name="metadata_web_link_fragment_key" xml:space="preserve">
<value>Fragment</value>
</data>
<data name="clipboard_item_image_title" xml:space="preserve">
<value>Image</value>
</data>
<data name="metadata_general_section_title" xml:space="preserve">
<value>General</value>
</data>
<data name="metadata_copied_key" xml:space="preserve">
<value>Copied</value>
</data>
<data name="metadata_file_system_folder_value" xml:space="preserve">
<value>Folder</value>
</data>
</root>

View File

@@ -171,17 +171,24 @@ public partial class InstallPackageListItem : ListItem
{
if (metadata.Tags.Count > 0)
{
var tags = new ITag[metadata.Tags.Count];
for (var i = 0; i < metadata.Tags.Count; i++)
{
var tag = new Tag(metadata.Tags[i]);
tags[i] = tag;
}
DetailsElement pair = new()
{
Key = "Tags",
Data = new DetailsTags() { Tags = metadata.Tags.Select(t => new Tag(t)).ToArray() },
Data = new DetailsTags { Tags = tags },
};
detailsElements.Add(pair);
}
}
catch (Exception ex)
{
Logger.LogWarning($"Failed to retrieve tags from metadata: {ex.Message}");
Logger.LogWarning($"Failed to retrieve tags from metadata: {ex}");
}
return detailsElements;

View File

@@ -6,7 +6,10 @@ using Windows.Foundation;
namespace Microsoft.CommandPalette.Extensions.Toolkit;
public abstract partial class CommandProvider : ICommandProvider, ICommandProvider2
public abstract partial class CommandProvider :
ICommandProvider,
ICommandProvider2,
ICommandProvider3
{
public virtual string Id { get; protected set; } = string.Empty;
@@ -48,6 +51,21 @@ public abstract partial class CommandProvider : ICommandProvider, ICommandProvid
}
}
/// <summary>
/// Get the dock bands provided by this command provider. Dock bands are
/// strips of items that appear on various UI surfaces in CmdPal, such as a
/// toolbar. Each ICommandItem returned from this method will be treated as
/// one atomic band by cmdpal.
///
/// If the command on an item here is a
/// IListPage, then cmdpal will render all of the items on that page as one
/// band. You can use this to create complex bands with multiple buttons.
/// </summary>
public virtual ICommandItem[]? GetDockBands()
{
return null;
}
/// <summary>
/// This is used to manually populate the WinRT type cache in CmdPal with
/// any interfaces that might not follow a straight linear path of requires.

View File

@@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CommandPalette.Extensions.Toolkit;
/// <summary>
/// Helper class for creating a band out of a set of items. This allows you to
/// simply just instantiate a set of buttons as ListItems, then pass them in to
/// this class to create a band from those items. For example:
///
/// ```cs
/// var foo = new MyFooListItem();
/// var bar = new MyBarListItem();
/// var band = new WrappedDockItem([foo, bar], "com.me.myBand", "My cool desk band");
/// ```
/// </summary>
public partial class WrappedDockItem : CommandItem
{
public override string Title => _itemTitle;
public override ICommand? Command => _backingList;
private readonly string _itemTitle;
private readonly WrappedDockList _backingList;
public IListItem[] Items { get => _backingList.GetItems(); set => _backingList.SetItems(value); }
public WrappedDockItem(
ICommand command,
string displayTitle)
{
_backingList = new WrappedDockList(command);
_itemTitle = string.IsNullOrEmpty(displayTitle) ? command.Name : displayTitle;
Icon = command.Icon;
}
// This was too much of a foot gun - we'd internally create a ListItem that
// didn't bubble the prop change events back up. That was bad.
// public WrappedDockItem(
// ICommandItem item,
// string id,
// string displayTitle)
// {
// _backingList = new WrappedDockList(item, id);
// _itemTitle = string.IsNullOrEmpty(displayTitle) ? item.Title : displayTitle;
// _icon = item.Icon;
// }
/// <summary>
/// Initializes a new instance of the <see cref="WrappedDockItem"/> class.
/// Create a new dock band for a set of list items
/// </summary>
public WrappedDockItem(
IListItem[] items,
string id,
string displayTitle)
{
_backingList = new WrappedDockList(items, id, displayTitle);
_itemTitle = displayTitle;
}
}

View File

@@ -0,0 +1,86 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.CommandPalette.Extensions.Toolkit;
/// <summary>
/// Helper class for a list page that just holds a set of items as a band.
/// The page itself doesn't do anything interesting.
/// </summary>
internal sealed partial class WrappedDockList : ListPage
{
private string _id;
public override string Id => _id;
private List<IListItem> _items;
internal WrappedDockList(ICommand command)
{
_items = new() { new ListItem(command) };
Name = command.Name;
_id = command.Id;
}
// Maybe revisit sometime.
// The hard problem is that the wrapping item will not
// listen for property changes on the inner item.
// public WrappedDockList(ICommandItem item, string id)
// {
// var command = item.Command;
// _items = new()
// {
// new ListItem(command)
// {
// Title = item.Title,
// Subtitle = item.Subtitle,
// Icon = item.Icon,
// MoreCommands = item.MoreCommands,
// },
// };
// Name = command.Name;
// _id = string.IsNullOrEmpty(id) ? command.Id : id;
// }
/// <summary>
/// Initializes a new instance of the <see cref="WrappedDockList"/> class.
/// Create a new list page for the set of items provided.
/// </summary>
internal WrappedDockList(IListItem[] items, string id, string name)
{
_items = new(items);
Name = name;
_id = id;
}
internal WrappedDockList(ICommand[] items, string id, string name)
{
_items = new();
foreach (var item in items)
{
_items.Add(new ListItem(item));
}
Name = name;
_id = id;
}
public override IListItem[] GetItems()
{
return _items.ToArray();
}
internal void SetItems(IListItem[]? newItems)
{
if (newItems == null)
{
_items = [];
RaiseItemsChanged(0);
return;
}
ListHelpers.InPlaceUpdateList(_items, newItems);
RaiseItemsChanged(_items.Count);
}
}

View File

@@ -405,6 +405,11 @@ namespace Microsoft.CommandPalette.Extensions
{
Object[] GetApiExtensionStubs();
};
[contract(Microsoft.CommandPalette.Extensions.ExtensionsContract, 1)]
interface ICommandProvider3 requires ICommandProvider2
{
ICommandItem[] GetDockBands();
};
}

View File

@@ -31,7 +31,6 @@
<None Remove="Assets\Settings\Modules\LightSwitch.png" />
<None Remove="SettingsXAML\Controls\Dashboard\CheckUpdateControl.xaml" />
<None Remove="SettingsXAML\Controls\Dashboard\ShortcutConflictControl.xaml" />
<None Remove="SettingsXAML\Controls\KeyVisual\KeyCharPresenter.xaml" />
<None Remove="SettingsXAML\Controls\TitleBar\TitleBar.xaml" />
</ItemGroup>
<ItemGroup>
@@ -113,6 +112,7 @@
<!-- HACK: Common.UI is referenced, even if it is not used, to force dll versions to be the same as in other projects that use it. It's still unclear why this is the case, but this is need for flattening the install directory. -->
<ProjectReference Include="..\..\common\Common.Search\Common.Search.csproj" />
<ProjectReference Include="..\..\common\Common.UI\Common.UI.csproj" />
<ProjectReference Include="..\..\common\Common.UI.Controls\Common.UI.Controls.csproj" />
<ProjectReference Include="..\..\common\GPOWrapper\GPOWrapper.vcxproj" />
<ProjectReference Include="..\..\common\interop\PowerToys.Interop.vcxproj" />
<ProjectReference Include="..\..\modules\ZoomIt\ZoomItSettingsInterop\ZoomItSettingsInterop.vcxproj" />
@@ -174,15 +174,9 @@
<None Update="Assets\Settings\Scripts\DisableModule.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Page Update="SettingsXAML\Controls\ShortcutControl\ShortcutWithTextLabelControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="SettingsXAML\Controls\TitleBar\TitleBar.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="SettingsXAML\Controls\KeyVisual\KeyCharPresenter.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="SettingsXAML\Controls\GPOInfoControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>

View File

@@ -1,17 +1,19 @@
<Application
<Application
x:Class="Microsoft.PowerToys.Settings.UI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyCharPresenter.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyVisual.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/KeyVisual/KeyCharPresenter.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/TitleBar/TitleBar.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/TextBlock.xaml" />
<ResourceDictionary Source="/SettingsXAML/Styles/Button.xaml" />
@@ -19,7 +21,7 @@
<ResourceDictionary Source="/SettingsXAML/Themes/Colors.xaml" />
<ResourceDictionary Source="/SettingsXAML/Themes/Generic.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/Timeline/TimelineStyles.xaml" />
<ResourceDictionary Source="/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml" />
<ResourceDictionary Source="ms-appx:///PowerToys.Common.UI.Controls/Controls/ShortcutWithTextLabelControl/ShortcutWithTextLabelControl.xaml" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
@@ -74,7 +76,7 @@
<Setter Property="IsTabStop" Value="False" />
</Style>
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="controls:CheckBoxWithDescriptionControl" />
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="ptcontrols:CheckBoxWithDescriptionControl" />
<tkcontrols:MarkdownThemes
x:Key="DescriptionTextMarkdownThemeConfig"

View File

@@ -300,9 +300,9 @@ namespace Microsoft.PowerToys.Settings.UI
return 0;
});
#else
/* If we try to run Settings as a standalone app, it will start PowerToys.exe if not running and open Settings again through it in the Dashboard page. */
Common.UI.SettingsDeepLink.OpenSettings(Common.UI.SettingsDeepLink.SettingsWindow.Dashboard);
Exit();
/* If we try to run Settings as a standalone app, it will start PowerToys.exe if not running and open Settings again through it in the Dashboard page. */
global::Common.UI.SettingsDeepLink.OpenSettings(global::Common.UI.SettingsDeepLink.SettingsWindow.Dashboard);
Exit();
#endif
}
}

View File

@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hotkeyConflicts="using:Microsoft.PowerToys.Settings.UI.Library.HotkeyConflicts"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:winuiex="using:WinUIEx"
@@ -93,7 +94,7 @@
Orientation="Vertical">
<!-- Hotkey Header -->
<Grid Margin="16,12,16,12">
<controls:ShortcutWithTextLabelControl
<ptcontrols:ShortcutWithTextLabelControl
x:Uid="ShortcutConflictWindow_ModulesUsingShortcut"
VerticalAlignment="Center"
FontWeight="SemiBold"

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
d:DesignHeight="300"
d:DesignWidth="400"
@@ -27,7 +28,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
<ptcontrols:KeyVisual
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"

View File

@@ -3,9 +3,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:converters="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
x:Name="LayoutRoot"
d:DesignHeight="300"
@@ -36,7 +37,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
<ptcontrols:KeyVisual
MinWidth="36"
Padding="8,8,8,8"
VerticalAlignment="Center"
@@ -57,18 +58,18 @@
CornerRadius="{StaticResource ControlCornerRadius}"
Orientation="Horizontal"
Spacing="8">
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
VerticalAlignment="Center"
FontFamily="Segoe Fluent Icons"
FontSize="12"
Text="&#xE710;" />
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
x:Uid="ConfigureShortcutText"
Margin="0,-1,0,0"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
</StackPanel>
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
x:Name="EditIcon"
Margin="0,0,4,0"
VerticalAlignment="Center"

View File

@@ -3,9 +3,10 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:converters="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tk7controls="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
x:Name="ShortcutContentControl"
@@ -227,7 +228,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
<ptcontrols:KeyVisual
Padding="20,16"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl x:Uid="Oobe_AdvancedPaste" HeroImage="ms-appx:///Assets/Settings/Modules/OOBE/AdvancedPaste.gif">
@@ -12,13 +13,13 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="AdvancedPasteUIHotkeyControl" x:Uid="Oobe_AdvancedPasteUI_HowToUse" />
<controls:ShortcutWithTextLabelControl x:Name="PasteAsPlainTextHotkeyControl" x:Uid="Oobe_AdvancedPastePlain_HowToUse" />
<controls:ShortcutWithTextLabelControl
<ptcontrols:ShortcutWithTextLabelControl x:Name="AdvancedPasteUIHotkeyControl" x:Uid="Oobe_AdvancedPasteUI_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="PasteAsPlainTextHotkeyControl" x:Uid="Oobe_AdvancedPastePlain_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl
x:Name="PasteAsMarkdownHotkeyControl"
x:Uid="Oobe_AdvancedPasteMarkdown_HowToUse"
Visibility="Collapsed" />
<controls:ShortcutWithTextLabelControl
<ptcontrols:ShortcutWithTextLabelControl
x:Name="PasteAsJsonHotkeyControl"
x:Uid="Oobe_AdvancedPasteJson_HowToUse"
Visibility="Collapsed" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_AlwaysOnTop_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_AlwaysOnTop_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_CmdPal_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_CmdPal_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_ColorPicker_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_ColorPicker_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl x:Uid="Oobe_CropAndLock" HeroImage="ms-appx:///Assets/Settings/Modules/OOBE/CropAndLock.gif">
@@ -12,11 +13,11 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="ThumbnailHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Thumbnail" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="ThumbnailHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Thumbnail" />
<controls:ShortcutWithTextLabelControl x:Name="ReparentHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Reparent" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="ReparentHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Reparent" />
<controls:ShortcutWithTextLabelControl x:Name="ScreenshotHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Screenshot" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="ScreenshotHotkeyControl" x:Uid="Oobe_CropAndLock_HowToUse_Screenshot" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -14,7 +15,7 @@
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<tkcontrols:MarkdownTextBlock x:Uid="Oobe_FancyZones_HowToUse" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_FancyZones_HowToUse_Shortcut" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_FancyZones_HowToUse_Shortcut" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToLaunch" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyActivation" x:Uid="Oobe_MeasureTool_Activation" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyActivation" x:Uid="Oobe_MeasureTool_Activation" />
<tkcontrols:MarkdownTextBlock x:Uid="Oobe_MeasureTool_HowToLaunch" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl x:Uid="Oobe_Peek" HeroImage="ms-appx:///Assets/Settings/Modules/OOBE/Peek.png">
@@ -12,7 +13,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Peek_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Peek_HowToUse" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToLaunch" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyActivation" x:Uid="Oobe_PowerDisplay_Activation" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyActivation" x:Uid="Oobe_PowerDisplay_Activation" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_TextExtractor_HowToUse" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_TextExtractor_HowToUse" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -13,7 +14,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToLaunch" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Run_HowToLaunch" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Run_HowToLaunch" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl x:Uid="Oobe_ShortcutGuide" HeroImage="ms-appx:///Assets/Settings/Modules/OOBE/ShortcutGuide.png">
@@ -12,7 +13,7 @@
<StackPanel Orientation="Vertical" Spacing="12">
<TextBlock x:Uid="Oobe_HowToLaunch" Style="{ThemeResource OobeSubtitleStyle}" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_ShortcutGuide_HowToLaunch" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_ShortcutGuide_HowToLaunch" />
<StackPanel Orientation="Horizontal" Spacing="8">
<Button

View File

@@ -5,6 +5,7 @@
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
mc:Ignorable="d">
@@ -14,7 +15,7 @@
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
<tkcontrols:MarkdownTextBlock x:Uid="Oobe_Workspaces_HowToUse" />
<controls:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Workspaces_HowToUse_Shortcut" />
<ptcontrols:ShortcutWithTextLabelControl x:Name="HotkeyControl" x:Uid="Oobe_Workspaces_HowToUse_Shortcut" />
<TextBlock x:Uid="Oobe_TipsAndTricks" Style="{ThemeResource OobeSubtitleStyle}" />

View File

@@ -3,6 +3,5 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/SettingsGroup/SettingsGroup.xaml" />
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/GPOInfoControl.xaml" />
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/IsEnabledTextBlock.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -8,6 +8,7 @@
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:Microsoft.PowerToys.Settings.UI.Library"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
@@ -154,16 +155,16 @@
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.AdvancedPasteUIShortcut, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard Name="AdvancedPasteEnableClipboardPreview" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_EnableClipboardPreview" IsChecked="{x:Bind ViewModel.EnableClipboardPreview, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_EnableClipboardPreview" IsChecked="{x:Bind ViewModel.EnableClipboardPreview, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="AdvancedPasteAutoCopySelectionCustomAction" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_AutoCopySelectionForCustomActionHotkey" IsChecked="{x:Bind ViewModel.AutoCopySelectionForCustomActionHotkey, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_AutoCopySelectionForCustomActionHotkey" IsChecked="{x:Bind ViewModel.AutoCopySelectionForCustomActionHotkey, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard
Name="AdvancedPasteClipboardHistoryEnabledSettingsCard"
ContentAlignment="Left"
IsEnabled="{x:Bind ViewModel.ClipboardHistoryEnabled, Mode=OneWay}">
<controls:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_Clipboard_History_Enabled_SettingsCard" IsChecked="{x:Bind ViewModel.ClipboardHistoryEnabled, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_Clipboard_History_Enabled_SettingsCard" IsChecked="{x:Bind ViewModel.ClipboardHistoryEnabled, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<InfoBar
x:Uid="GPO_SettingIsManaged"
@@ -179,7 +180,7 @@
<CheckBox x:Uid="AdvancedPaste_CloseAfterLosingFocus" IsChecked="{x:Bind ViewModel.CloseAfterLosingFocus, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="AdvancedPasteShowCustomPreviewSettingsCard" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_ShowCustomPreviewSettingsCard" IsChecked="{x:Bind ViewModel.ShowCustomPreview, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="AdvancedPaste_ShowCustomPreviewSettingsCard" IsChecked="{x:Bind ViewModel.ShowCustomPreview, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
@@ -195,7 +196,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
<ptcontrols:KeyVisual
Padding="8,8,8,8"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"

View File

@@ -9,6 +9,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
@@ -41,7 +42,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:KeyVisual
<ptcontrols:KeyVisual
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
Content="{Binding}"

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
@@ -76,7 +77,7 @@
<CheckBox x:Uid="FancyZones_ShowZonesOnAllMonitorsCheckBoxControl" IsChecked="{x:Bind ViewModel.ShowOnAllMonitors, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="FancyZonesSpanZonesAcrossMonitors" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="FancyZones_SpanZonesAcrossMonitors" IsChecked="{x:Bind ViewModel.SpanZonesAcrossMonitors, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="FancyZones_SpanZonesAcrossMonitors" IsChecked="{x:Bind ViewModel.SpanZonesAcrossMonitors, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="FancyZonesOverlappingZones" x:Uid="FancyZones_OverlappingZones">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.OverlappingZonesAlgorithmIndex, Mode=TwoWay}">
@@ -231,7 +232,7 @@
SelectedIndex="{x:Bind ViewModel.MoveWindowsBasedOnPosition, Mode=TwoWay, Converter={StaticResource BoolToComboBoxIndexConverter}}">
<ComboBoxItem x:Uid="FancyZones_MoveWindowLeftRightBasedOnZoneIndex_Accessible">
<StackPanel Orientation="Vertical" Spacing="4">
<controls:IsEnabledTextBlock x:Uid="FancyZones_MoveWindowLeftRightBasedOnZoneIndex" />
<ptcontrols:IsEnabledTextBlock x:Uid="FancyZones_MoveWindowLeftRightBasedOnZoneIndex" />
<TextBlock FontFamily="{ThemeResource SymbolThemeFontFamily}" Style="{StaticResource SecondaryTextStyle}">
<Run x:Uid="FancyZones_MoveWindowLeftRightBasedOnZoneIndex_Description" />
</TextBlock>
@@ -239,7 +240,7 @@
</ComboBoxItem>
<ComboBoxItem x:Uid="FancyZones_MoveWindowBasedOnRelativePosition_Accessible">
<StackPanel Orientation="Vertical" Spacing="4">
<controls:IsEnabledTextBlock x:Uid="FancyZones_MoveWindowBasedOnRelativePosition" />
<ptcontrols:IsEnabledTextBlock x:Uid="FancyZones_MoveWindowBasedOnRelativePosition" />
<TextBlock FontFamily="{ThemeResource SymbolThemeFontFamily}" Style="{StaticResource SecondaryTextStyle}">
<Run x:Uid="FancyZones_MoveWindowBasedOnRelativePosition_Description" />
</TextBlock>

View File

@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
@@ -74,10 +75,10 @@
ContentAlignment="Left"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsAutoDownloadUpdatesCardEnabled}"
Visibility="{x:Bind ViewModel.IsAdmin, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_AutoDownloadAndInstallUpdates" IsChecked="{Binding Mode=TwoWay, Path=AutoDownloadUpdates}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="GeneralPage_AutoDownloadAndInstallUpdates" IsChecked="{Binding Mode=TwoWay, Path=AutoDownloadUpdates}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsShowNewUpdatesToastNotificationCardEnabled}">
<controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_ShowNewUpdatesToast" IsChecked="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="GeneralPage_ShowNewUpdatesToast" IsChecked="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsShowWhatsNewAfterUpdatesCardEnabled}">
<CheckBox x:Uid="GeneralPage_ShowWhatsNewAfterUpdates" IsChecked="{Binding Mode=TwoWay, Path=ShowWhatsNewAfterUpdates}" />
@@ -223,7 +224,7 @@
IsEnabled="{Binding IsAdminButtonEnabled}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsElevated, Mode=OneWay}">
<controls:CheckBoxWithDescriptionControl x:Uid="GeneralSettings_AlwaysRunAsAdminText" IsChecked="{x:Bind ViewModel.RunElevated, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="GeneralSettings_AlwaysRunAsAdminText" IsChecked="{x:Bind ViewModel.RunElevated, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="GeneralPage_WarningsElevatedApps" IsChecked="{Binding Mode=TwoWay, Path=EnableWarningsElevatedApps}" />

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
xmlns:ui="using:CommunityToolkit.WinUI"
@@ -99,19 +100,18 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<controls:IsEnabledTextBlock
x:Name="pathTextBlock"
<ptcontrols:IsEnabledTextBlock
Grid.Column="0"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Text="{x:Bind ViewModel.BackupPath, Mode=TwoWay}">
<ToolTipService.ToolTip>
<ToolTip IsEnabled="{Binding IsTextTrimmed, ElementName=pathTextBlock, Mode=OneWay}">
<ToolTip>
<TextBlock Text="{x:Bind ViewModel.BackupPath, Mode=TwoWay}" />
</ToolTip>
</ToolTipService.ToolTip>
</controls:IsEnabledTextBlock>
</ptcontrols:IsEnabledTextBlock>
<Button
Grid.Column="1"
Command="{x:Bind ViewModel.SelectBackupPathEventHandler}"

View File

@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
xmlns:ui="using:CommunityToolkit.WinUI"
@@ -20,14 +21,14 @@
</Style>
<DataTemplate x:Key="OriginalKeyTemplate" x:DataType="x:String">
<controls:KeyVisual
<ptcontrols:KeyVisual
Padding="8"
Content="{Binding}"
CornerRadius="{StaticResource ControlCornerRadius}" />
</DataTemplate>
<DataTemplate x:Key="RemappedKeyTemplate" x:DataType="x:String">
<controls:KeyVisual
<ptcontrols:KeyVisual
Padding="8"
Content="{Binding}"
CornerRadius="{StaticResource ControlCornerRadius}"
@@ -107,7 +108,7 @@
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
x:Uid="To"
Margin="8,0,8,0"
VerticalAlignment="Center"
@@ -182,14 +183,14 @@
</ItemsControl.ItemsPanel>
</ItemsControl>
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
x:Uid="To"
Margin="8,0,8,0"
VerticalAlignment="Center"
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}"
Visibility="{x:Bind Path=IsOpenUriOrIsRunProgram, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibilityConverter}}" />
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
x:Uid="Starts"
Margin="8,0,8,0"
VerticalAlignment="Center"

View File

@@ -8,6 +8,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:viewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
@@ -91,7 +92,7 @@
x:Uid="LightSwitch_LocationSettingsCard"
Visibility="Collapsed">
<StackPanel Orientation="Horizontal" Spacing="8">
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind ViewModel.SyncButtonInformation, Mode=OneWay}" />
@@ -109,7 +110,7 @@
<StackPanel Orientation="Horizontal" Spacing="20">
<StackPanel Orientation="Horizontal" Spacing="8">
<!--<FontIcon Glyph="&#xED39;" FontSize="16" />-->
<controls:IsEnabledTextBlock x:Uid="LightSwitch_SunriseText" VerticalAlignment="Center" />
<ptcontrols:IsEnabledTextBlock x:Uid="LightSwitch_SunriseText" VerticalAlignment="Center" />
<NumberBox
AutomationProperties.AutomationId="SunriseOffset_LightSwitch"
Maximum="{x:Bind ViewModel.SunriseOffsetMax, Mode=OneWay}"
@@ -118,7 +119,7 @@
Value="{x:Bind ViewModel.SunriseOffset, Mode=TwoWay}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<controls:IsEnabledTextBlock x:Uid="LightSwitch_SunsetText" VerticalAlignment="Center" />
<ptcontrols:IsEnabledTextBlock x:Uid="LightSwitch_SunsetText" VerticalAlignment="Center" />
<NumberBox
AutomationProperties.AutomationId="SunsetOffset_LightSwitch"
Maximum="{x:Bind ViewModel.SunsetOffsetMax, Mode=OneWay}"
@@ -200,13 +201,13 @@
IsExpanded="True">
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard HorizontalContentAlignment="Stretch" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
x:Uid="LightSwitch_SystemCheckbox"
AutomationProperties.AutomationId="ChangeSystemCheckbox_LightSwitch"
IsChecked="{x:Bind ViewModel.ChangeSystem, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard HorizontalContentAlignment="Stretch" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
x:Uid="LightSwitch_AppsCheckbox"
AutomationProperties.AutomationId="ChangeAppsCheckbox_LightSwitch"
IsChecked="{x:Bind ViewModel.ChangeApps, Mode=TwoWay}" />

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
xmlns:ui="using:CommunityToolkit.WinUI"
@@ -77,7 +78,7 @@
<tkcontrols:SettingsCard Name="MouseWithoutBordersThisMachineNameLabel" x:Uid="MouseWithoutBorders_ThisMachineNameLabel">
<StackPanel Orientation="Horizontal" Spacing="8">
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
@@ -237,16 +238,16 @@
<CheckBox x:Uid="MouseWithoutBorders_WrapMouse" IsChecked="{x:Bind ViewModel.WrapMouse, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="MouseWithoutBordersMoveMouseRelatively" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="MouseWithoutBorders_MoveMouseRelatively" IsChecked="{x:Bind ViewModel.MoveMouseRelatively, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="MouseWithoutBorders_MoveMouseRelatively" IsChecked="{x:Bind ViewModel.MoveMouseRelatively, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="MouseWithoutBordersBlockMouseAtScreenCorners" ContentAlignment="Left">
<CheckBox x:Uid="MouseWithoutBorders_BlockMouseAtScreenCorners" IsChecked="{x:Bind ViewModel.BlockMouseAtScreenCorners, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="MouseWithoutBordersHideMouseAtScreenEdge" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="MouseWithoutBorders_HideMouseAtScreenEdge" IsChecked="{x:Bind ViewModel.HideMouseAtScreenEdge, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="MouseWithoutBorders_HideMouseAtScreenEdge" IsChecked="{x:Bind ViewModel.HideMouseAtScreenEdge, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard Name="MouseWithoutBordersDrawMouseCursor" ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="MouseWithoutBorders_DrawMouseCursor" IsChecked="{x:Bind ViewModel.DrawMouseCursor, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="MouseWithoutBorders_DrawMouseCursor" IsChecked="{x:Bind ViewModel.DrawMouseCursor, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
@@ -70,7 +71,7 @@
<CheckBox x:Uid="Peek_SourceCode_WrapText" IsChecked="{x:Bind ViewModel.SourceCodeWrapText, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
x:Uid="Peek_SourceCode_TryFormat"
IsChecked="{x:Bind ViewModel.SourceCodeTryFormat, Mode=TwoWay}"
IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}" />

View File

@@ -9,6 +9,7 @@
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
xmlns:viewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
@@ -45,7 +46,7 @@
BorderThickness="0,0,0,0"
ContentAlignment="Left"
CornerRadius="0">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
Margin="56,0,0,0"
Description="{x:Bind Path=DisplayDescription}"
Header="{x:Bind Path=DisplayLabel}"
@@ -160,7 +161,7 @@
BorderThickness="0,0,0,0"
ContentAlignment="Left"
CornerRadius="0">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
Margin="56,0,0,0"
Description="{x:Bind Path=DisplayDescription}"
Header="{x:Bind Path=DisplayLabel}"
@@ -197,7 +198,7 @@
BorderThickness="0,0,0,0"
ContentAlignment="Left"
CornerRadius="0">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
Margin="56,0,0,0"
Description="{x:Bind Path=DisplayDescription}"
Header="{x:Bind Path=DisplayLabel}"
@@ -234,7 +235,7 @@
BorderThickness="0,0,0,0"
ContentAlignment="Left"
CornerRadius="0">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
Margin="56,0,0,0"
Description="{x:Bind Path=DisplayDescription}"
Header="{x:Bind Path=DisplayLabel}"
@@ -276,7 +277,7 @@
BorderThickness="0,0,0,0"
ContentAlignment="Left"
CornerRadius="0">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
Margin="56,0,0,0"
Description="{x:Bind Path=DisplayDescription}"
Header="{x:Bind Path=DisplayLabel}"
@@ -342,7 +343,7 @@
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" />
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left">
<controls:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind ViewModel.UseCentralizedKeyboardHook, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_UseCentralizedKeyboardHook" IsChecked="{x:Bind ViewModel.UseCentralizedKeyboardHook, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="PowerLauncher_IgnoreHotkeysInFullScreen" IsChecked="{x:Bind ViewModel.IgnoreHotkeysInFullScreen, Mode=TwoWay}" />
@@ -459,7 +460,7 @@
Value="{x:Bind ViewModel.SearchClickedItemWeight, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.SearchQueryTuningEnabled, Mode=OneWay}">
<controls:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind ViewModel.SearchWaitForSlowResults, Mode=TwoWay}" />
<ptcontrols:CheckBoxWithDescriptionControl x:Uid="PowerLauncher_WaitForSlowResults" IsChecked="{x:Bind ViewModel.SearchWaitForSlowResults, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>
@@ -548,7 +549,7 @@
x:Uid="PowerLauncher_TitleFontSize"
HeaderIcon="{ui:FontIcon Glyph=&#xE8E9;}">
<StackPanel Orientation="Horizontal" Spacing="12">
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
FontSize="12"
@@ -564,7 +565,7 @@
TickFrequency="2"
TickPlacement="Outside"
Value="{x:Bind ViewModel.TitleFontSize, Mode=TwoWay}" />
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
FontSize="24"
@@ -709,7 +710,7 @@
IsChecked="{x:Bind IsGlobal, Mode=TwoWay}">
<StackPanel Orientation="Vertical">
<TextBlock x:Name="IncludeInGlobalResultTitle" x:Uid="PowerLauncher_IncludeInGlobalResultTitle" />
<controls:IsEnabledTextBlock
<ptcontrols:IsEnabledTextBlock
x:Uid="PowerLauncher_IncludeInGlobalResultDescription"
FontSize="{StaticResource SecondaryTextFontSize}"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />

View File

@@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Helpers"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ptcontrols="using:Microsoft.PowerToys.Common.UI.Controls"
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
xmlns:ui="using:CommunityToolkit.WinUI"
AutomationProperties.LandmarkType="Main"
@@ -89,7 +90,7 @@
<CheckBox x:Uid="FileExplorerPreview_ToggleSwitch_Monaco_Wrap_Text" IsChecked="{x:Bind ViewModel.MonacoWrapText, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}">
<controls:CheckBoxWithDescriptionControl
<ptcontrols:CheckBoxWithDescriptionControl
x:Uid="FileExplorerPreview_ToggleSwitch_Monaco_Try_Format"
IsChecked="{x:Bind ViewModel.MonacoPreviewTryFormat, Mode=TwoWay}"
IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}" />