mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
<!-- 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 Attempt to fix `Layout cycle detected. Layout could not complete` exception when CmdPal is moved on a screen with different DPI. I can repro almost 100% and no longer occurs after switching tags `ItemsView` with `ItemsControl`. Doesn't seem to break visual and don't expect a huge number of tags so use an `ItemsControl` shouldn't be a problem. <img width="491" alt="image" src="https://github.com/user-attachments/assets/05b698b2-ebe7-4356-bdaa-4de93aea13e6" /> <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If 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
166 lines
7.5 KiB
XML
166 lines
7.5 KiB
XML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<Page
|
|
x:Class="Microsoft.CmdPal.UI.ListPage"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
|
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
|
|
xmlns:cpcontrols="using:Microsoft.CmdPal.UI.Controls"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:help="using:Microsoft.CmdPal.UI.Helpers"
|
|
xmlns:local="using:Microsoft.CmdPal.UI"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:viewmodels="using:Microsoft.CmdPal.UI.ViewModels"
|
|
Background="Transparent"
|
|
mc:Ignorable="d">
|
|
|
|
<Page.Resources>
|
|
<!-- TODO: Figure out what we want to do here for filtering/grouping and where -->
|
|
<!-- https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.data.collectionviewsource -->
|
|
<!--<CollectionViewSource
|
|
x:Name="ItemsCVS"
|
|
IsSourceGrouped="True"
|
|
Source="{x:Bind ViewModel.Items, Mode=OneWay}" />-->
|
|
|
|
<converters:StringVisibilityConverter
|
|
x:Key="StringVisibilityConverter"
|
|
EmptyValue="Collapsed"
|
|
NotEmptyValue="Visible" />
|
|
|
|
<DataTemplate x:Key="TagTemplate" x:DataType="viewmodels:TagViewModel">
|
|
<ItemContainer>
|
|
<cpcontrols:Tag
|
|
BackgroundColor="{x:Bind Background, Mode=OneWay}"
|
|
FontSize="12"
|
|
ForegroundColor="{x:Bind Foreground, Mode=OneWay}"
|
|
Icon="{x:Bind Icon, Mode=OneWay}"
|
|
Text="{x:Bind Text, Mode=OneWay}"
|
|
ToolTipService.ToolTip="{x:Bind ToolTip, Mode=OneWay}" />
|
|
</ItemContainer>
|
|
</DataTemplate>
|
|
|
|
<!-- https://learn.microsoft.com/windows/apps/design/controls/itemsview#specify-the-look-of-the-items -->
|
|
<DataTemplate x:Key="ListItemViewModelTemplate" x:DataType="viewmodels:ListItemViewModel">
|
|
|
|
<Grid Padding="0,12,0,12" ColumnSpacing="12">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="28" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<cpcontrols:IconBox
|
|
x:Name="IconBorder"
|
|
Grid.Column="0"
|
|
Width="20"
|
|
Height="20"
|
|
Margin="4,0,4,0"
|
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
SourceKey="{x:Bind Icon, Mode=OneWay}"
|
|
SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" />
|
|
|
|
<StackPanel
|
|
Grid.Column="1"
|
|
VerticalAlignment="Center"
|
|
Orientation="Vertical"
|
|
Spacing="1">
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
CharacterSpacing="12"
|
|
FontSize="14"
|
|
Text="{x:Bind Title, Mode=OneWay}"
|
|
TextTrimming="CharacterEllipsis"
|
|
TextWrapping="NoWrap" />
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
Style="{StaticResource CaptionTextBlockStyle}"
|
|
Text="{x:Bind Subtitle, Mode=OneWay}"
|
|
TextTrimming="CharacterEllipsis"
|
|
TextWrapping="NoWrap"
|
|
Visibility="{x:Bind Subtitle, Mode=OneWay, Converter={StaticResource StringVisibilityConverter}}" />
|
|
</StackPanel>
|
|
|
|
<ItemsControl
|
|
Grid.RowSpan="2"
|
|
Grid.Column="2"
|
|
Margin="0,0,8,0"
|
|
VerticalAlignment="Center"
|
|
IsHitTestVisible="False"
|
|
IsTabStop="False"
|
|
ItemTemplate="{StaticResource TagTemplate}"
|
|
ItemsSource="{x:Bind Tags, Mode=OneWay}"
|
|
Visibility="{x:Bind HasTags, Mode=OneWay}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<StackPanel Orientation="Horizontal" Spacing="4" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
</ItemsControl>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</Page.Resources>
|
|
|
|
<Grid>
|
|
<controls:SwitchPresenter
|
|
HorizontalAlignment="Stretch"
|
|
TargetType="x:Boolean"
|
|
Value="{x:Bind ViewModel.ShowEmptyContent, Mode=OneWay}">
|
|
<controls:Case Value="False">
|
|
<ListView
|
|
x:Name="ItemsList"
|
|
Padding="0,2,0,0"
|
|
DoubleTapped="ItemsList_DoubleTapped"
|
|
IsDoubleTapEnabled="True"
|
|
IsItemClickEnabled="True"
|
|
ItemClick="ItemsList_ItemClick"
|
|
ItemTemplate="{StaticResource ListItemViewModelTemplate}"
|
|
ItemsSource="{x:Bind ViewModel.FilteredItems, Mode=OneWay}"
|
|
SelectionChanged="ItemsList_SelectionChanged">
|
|
<ListView.ItemContainerTransitions>
|
|
<TransitionCollection />
|
|
</ListView.ItemContainerTransitions>
|
|
<!--<ListView.GroupStyle>
|
|
<GroupStyle HidesIfEmpty="True">
|
|
<GroupStyle.HeaderTemplate>
|
|
<DataTemplate>
|
|
<TextBlock
|
|
Margin="0,16,0,0"
|
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
Text="{Binding Key, Mode=OneWay}" />
|
|
</DataTemplate>
|
|
</GroupStyle.HeaderTemplate>
|
|
</GroupStyle>
|
|
</ListView.GroupStyle>-->
|
|
</ListView>
|
|
</controls:Case>
|
|
<controls:Case Value="True">
|
|
<StackPanel
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Orientation="Vertical"
|
|
Spacing="4">
|
|
<cpcontrols:IconBox
|
|
x:Name="IconBorder"
|
|
Width="56"
|
|
Height="56"
|
|
Margin="8"
|
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
SourceKey="{x:Bind ViewModel.EmptyContent.Icon, Mode=OneWay}"
|
|
SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" />
|
|
<TextBlock
|
|
Margin="0,4,0,0"
|
|
HorizontalAlignment="Center"
|
|
FontWeight="SemiBold"
|
|
Text="{x:Bind ViewModel.EmptyContent.Title, Mode=OneWay}" />
|
|
<TextBlock
|
|
HorizontalAlignment="Center"
|
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
|
Text="{x:Bind ViewModel.EmptyContent.Subtitle, Mode=OneWay}" />
|
|
</StackPanel>
|
|
</controls:Case>
|
|
</controls:SwitchPresenter>
|
|
|
|
</Grid>
|
|
</Page>
|