mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Deps]Upgrading to CommunityToolkit.WinUI v8.0 (#28205)
* Adding new package references * Updating namespaces and controls * Fixing GridSplitter * Bump up version numbers * Fix namespaces for Settings * Fixing FontIcon extensions * Use Toolkit converters * Update notice * Remove unused reference * Namespace fixes * Update MainPage.xaml * Upgrading packages to latest * Resolve CI issues * Fix Hosts merge
This commit is contained in:
@@ -57,7 +57,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Collections" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
x:Class="Hosts.Views.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:helpers="using:Hosts.Helpers"
|
||||
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
||||
@@ -10,6 +10,7 @@
|
||||
xmlns:local="using:Hosts.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="using:Hosts.Models"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
x:Name="Page"
|
||||
Loaded="Page_Loaded"
|
||||
mc:Ignorable="d">
|
||||
@@ -28,8 +29,8 @@
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<converters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
TrueValue="Collapsed"
|
||||
FalseValue="Visible" />
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
<converters:DoubleToVisibilityConverter
|
||||
x:Key="DoubleToVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
@@ -37,21 +38,17 @@
|
||||
TrueValue="Collapsed" />
|
||||
</Page.Resources>
|
||||
|
||||
<Grid
|
||||
Margin="16"
|
||||
RowSpacing="8">
|
||||
<Grid Margin="16" RowSpacing="8">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" /> <!-- Buttons -->
|
||||
<RowDefinition Height="*" /> <!-- Content -->
|
||||
<RowDefinition Height="Auto" />
|
||||
<!-- Buttons -->
|
||||
<RowDefinition Height="*" />
|
||||
<!-- Content -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid> <!-- Buttons -->
|
||||
<Button
|
||||
x:Uid="AddEntryBtn"
|
||||
Command="{x:Bind NewDialogCommand}">
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Grid>
|
||||
<!-- Buttons -->
|
||||
<Button x:Uid="AddEntryBtn" Command="{x:Bind NewDialogCommand}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<FontIcon
|
||||
x:Name="Icon"
|
||||
FontSize="16"
|
||||
@@ -60,9 +57,7 @@
|
||||
<TextBlock x:Uid="AddEntry" />
|
||||
</StackPanel>
|
||||
<Button.KeyboardAccelerators>
|
||||
<KeyboardAccelerator
|
||||
Modifiers="Control"
|
||||
Key="N" />
|
||||
<KeyboardAccelerator Key="N" Modifiers="Control" />
|
||||
</Button.KeyboardAccelerators>
|
||||
</Button>
|
||||
|
||||
@@ -74,19 +69,16 @@
|
||||
x:Uid="AdditionalLinesBtn"
|
||||
Height="32"
|
||||
Command="{x:Bind AdditionalLinesDialogCommand}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<FontIcon
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
</Button>
|
||||
Content="{ui:FontIcon Glyph=,
|
||||
FontSize=16}"
|
||||
Style="{StaticResource SubtleButtonStyle}" />
|
||||
|
||||
<Button
|
||||
x:Uid="FilterBtn"
|
||||
Height="32"
|
||||
Content="{ui:FontIcon Glyph=,
|
||||
FontSize=16}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<FontIcon
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
<Button.Flyout>
|
||||
<Flyout>
|
||||
<StackPanel
|
||||
@@ -124,15 +116,13 @@
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
</AutoSuggestBox>
|
||||
<ToggleSwitch
|
||||
x:Uid="ShowOnlyDuplicates"
|
||||
IsOn="{x:Bind ViewModel.ShowOnlyDuplicates, Mode=TwoWay}" />
|
||||
<ToggleSwitch x:Uid="ShowOnlyDuplicates" IsOn="{x:Bind ViewModel.ShowOnlyDuplicates, Mode=TwoWay}" />
|
||||
<Button
|
||||
x:Uid="ClearFiltersBtn"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{x:Bind ViewModel.ClearFiltersCommand}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
IsEnabled="{x:Bind ViewModel.Filtered, Mode=OneWay}"/>
|
||||
IsEnabled="{x:Bind ViewModel.Filtered, Mode=OneWay}"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
@@ -142,21 +132,18 @@
|
||||
x:Uid="OpenHostsFileBtn"
|
||||
Height="32"
|
||||
Command="{x:Bind ViewModel.OpenHostsFileCommand}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<FontIcon
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
</Button>
|
||||
Content="{ui:FontIcon Glyph=,
|
||||
FontSize=16}"
|
||||
Style="{StaticResource SubtleButtonStyle}" />
|
||||
|
||||
|
||||
<Button
|
||||
x:Uid="SettingsBtn"
|
||||
Height="32"
|
||||
Command="{x:Bind ViewModel.OpenSettingsCommand}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<FontIcon
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
</Button>
|
||||
Content="{ui:FontIcon Glyph=,
|
||||
FontSize=16}"
|
||||
Style="{StaticResource SubtleButtonStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -166,9 +153,7 @@
|
||||
CanDragItems="{x:Bind ViewModel.Filtered, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
|
||||
CanReorderItems="{x:Bind ViewModel.Filtered, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
|
||||
-->
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Visibility="{x:Bind ViewModel.IsLoading, Converter={StaticResource BoolToInvertedVisibilityConverter}, Mode=OneWay}">
|
||||
<Grid Grid.Row="1" Visibility="{x:Bind ViewModel.IsLoading, Converter={StaticResource BoolToInvertedVisibilityConverter}, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -181,9 +166,9 @@
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||
GotFocus="Entries_GotFocus"
|
||||
IsItemClickEnabled="True"
|
||||
ItemClick="Entries_ItemClick"
|
||||
GotFocus="Entries_GotFocus"
|
||||
RightTapped="Entries_RightTapped"
|
||||
ItemsSource="{x:Bind ViewModel.Entries, Mode=TwoWay}"
|
||||
SelectedItem="{x:Bind ViewModel.Selected, Mode=TwoWay}">
|
||||
@@ -271,8 +256,8 @@
|
||||
Height="20"
|
||||
IsActive="{x:Bind Pinging, Mode=OneWay}" />
|
||||
<FontIcon
|
||||
x:Uid="PingIcon"
|
||||
x:Name="PingIcon"
|
||||
x:Uid="PingIcon"
|
||||
Grid.Column="2"
|
||||
FontSize="16"
|
||||
Visibility="Collapsed">
|
||||
@@ -325,8 +310,8 @@
|
||||
<FontIcon
|
||||
x:Uid="DuplicateEntryIcon"
|
||||
Grid.Column="3"
|
||||
Foreground="{StaticResource SystemControlErrorTextForegroundBrush}"
|
||||
FontSize="16"
|
||||
Foreground="{StaticResource SystemControlErrorTextForegroundBrush}"
|
||||
Glyph=""
|
||||
Visibility="{x:Bind Duplicate, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<ToggleSwitch
|
||||
@@ -352,14 +337,12 @@
|
||||
VerticalAlignment="Center"
|
||||
Spacing="8"
|
||||
Visibility="{x:Bind ViewModel.Filtered, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}">
|
||||
<FontIcon
|
||||
FontSize="32"
|
||||
Glyph="" />
|
||||
<FontIcon FontSize="32" Glyph="" />
|
||||
<TextBlock
|
||||
x:Uid="EmptyHosts"
|
||||
HorizontalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
TextWrapping="Wrap" />
|
||||
<HyperlinkButton
|
||||
x:Uid="AddEntryLink"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -371,14 +354,12 @@
|
||||
VerticalAlignment="Center"
|
||||
Spacing="8"
|
||||
Visibility="{x:Bind ViewModel.Filtered, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<FontIcon
|
||||
FontSize="32"
|
||||
Glyph="" />
|
||||
<FontIcon FontSize="32" Glyph="" />
|
||||
<TextBlock
|
||||
x:Uid="EmptyFilterResults"
|
||||
HorizontalAlignment="Center"
|
||||
TextWrapping="Wrap"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
TextWrapping="Wrap" />
|
||||
<HyperlinkButton
|
||||
x:Uid="ClearFiltersLink"
|
||||
HorizontalAlignment="Center"
|
||||
@@ -386,8 +367,7 @@
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1">
|
||||
<StackPanel Grid.Row="1">
|
||||
<InfoBar
|
||||
x:Uid="FileSaveError"
|
||||
Margin="0,8,0,0"
|
||||
@@ -395,26 +375,23 @@
|
||||
Message="{x:Bind ViewModel.ErrorMessage, Mode=TwoWay}"
|
||||
IsOpen="{x:Bind ViewModel.Error, Mode=TwoWay}"
|
||||
Visibility="{x:Bind ViewModel.Error, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
|
||||
<InfoBar
|
||||
x:Uid="FileChanged"
|
||||
Margin="0,8,0,0"
|
||||
Severity="Informational"
|
||||
IsOpen="{x:Bind ViewModel.FileChanged, Mode=TwoWay}"
|
||||
Severity="Informational"
|
||||
Visibility="{x:Bind ViewModel.FileChanged, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<InfoBar.ActionButton>
|
||||
<Button
|
||||
x:Uid="Reload"
|
||||
Command="{x:Bind ViewModel.ReadHostsCommand}" />
|
||||
<Button x:Uid="Reload" Command="{x:Bind ViewModel.ReadHostsCommand}" />
|
||||
</InfoBar.ActionButton>
|
||||
</InfoBar>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<ProgressRing
|
||||
Grid.Row="1"
|
||||
Width="48"
|
||||
Height="48"
|
||||
Grid.Row="1"
|
||||
IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
|
||||
|
||||
<ContentDialog
|
||||
@@ -436,22 +413,22 @@
|
||||
Text="{Binding Address, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
x:Uid="Hosts"
|
||||
IsSpellCheckEnabled="False"
|
||||
AcceptsReturn="False"
|
||||
TextWrapping="Wrap"
|
||||
IsSpellCheckEnabled="False"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
Text="{Binding Hosts, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Hosts, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
x:Uid="Comment"
|
||||
IsSpellCheckEnabled="False"
|
||||
AcceptsReturn="False"
|
||||
TextWrapping="Wrap"
|
||||
IsSpellCheckEnabled="False"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
Text="{Binding Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap" />
|
||||
<ToggleSwitch
|
||||
x:Uid="Active"
|
||||
IsOn="{Binding Active, Mode=TwoWay}"
|
||||
@@ -477,9 +454,9 @@
|
||||
|
||||
<TextBox
|
||||
x:Name="AdditionalLines"
|
||||
HorizontalAlignment="Stretch"
|
||||
MinHeight="40"
|
||||
Padding="16,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
AcceptsReturn="True"
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
@@ -489,15 +466,12 @@
|
||||
|
||||
<TeachingTip
|
||||
x:Uid="TooManyHostsTeachingTip"
|
||||
IconSource="{ui:FontIconSource Glyph=}"
|
||||
IsOpen="{x:Bind ViewModel.ShowSplittedEntriesTooltip, Mode=OneWay}"
|
||||
PreferredPlacement="Top"
|
||||
PlacementMargin="20">
|
||||
<TeachingTip.IconSource>
|
||||
<FontIconSource Glyph="" />
|
||||
</TeachingTip.IconSource>
|
||||
PlacementMargin="20"
|
||||
PreferredPlacement="Top">
|
||||
<TeachingTip.Content>
|
||||
<TextBlock x:Uid="TooManyHostsTeachingTipContent"
|
||||
TextWrapping="Wrap"/>
|
||||
<TextBlock x:Uid="TooManyHostsTeachingTipContent" TextWrapping="Wrap" />
|
||||
</TeachingTip.Content>
|
||||
</TeachingTip>
|
||||
</Grid>
|
||||
|
||||
@@ -14,7 +14,7 @@ using Common.UI;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.WinUI;
|
||||
using CommunityToolkit.WinUI.UI;
|
||||
using CommunityToolkit.WinUI.Collections;
|
||||
using Hosts.Helpers;
|
||||
using Hosts.Models;
|
||||
using Hosts.Settings;
|
||||
|
||||
Reference in New Issue
Block a user