ModuleList.xaml
1 <UserControl 2 x:Class="Microsoft.PowerToys.Settings.UI.Controls.ModuleList" 3 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" 6 xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Controls.Converters" 7 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 8 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 9 xmlns:tk="using:CommunityToolkit.WinUI" 10 xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls" 11 xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters" 12 mc:Ignorable="d"> 13 14 <UserControl.Resources> 15 <converters:ModuleListSortOptionToBooleanConverter x:Key="ModuleListSortOptionToBooleanConverter" /> 16 <x:Double x:Key="SettingsCardWrapThreshold">0</x:Double> 17 <tkconverters:BoolToVisibilityConverter 18 x:Key="BoolToVisibilityConverter" 19 FalseValue="Collapsed" 20 TrueValue="Visible" /> 21 <tkconverters:BoolToVisibilityConverter 22 x:Key="ReverseBoolToVisibilityConverter" 23 FalseValue="Visible" 24 TrueValue="Collapsed" /> 25 <tkconverters:BoolNegationConverter x:Key="BoolNegationConverter" /> 26 27 <Style x:Key="NewInfoBadgeStyle" TargetType="InfoBadge"> 28 <Setter Property="Padding" Value="5,1,5,2" /> 29 <Setter Property="Template"> 30 <Setter.Value> 31 <ControlTemplate TargetType="InfoBadge"> 32 <Border 33 x:Name="RootGrid" 34 Padding="{TemplateBinding Padding}" 35 Background="{TemplateBinding Background}" 36 CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.InfoBadgeCornerRadius}"> 37 <TextBlock 38 x:Uid="NewInfoBadge" 39 HorizontalAlignment="Center" 40 VerticalAlignment="Center" 41 FontSize="10" /> 42 </Border> 43 </ControlTemplate> 44 </Setter.Value> 45 </Setter> 46 </Style> 47 </UserControl.Resources> 48 <ItemsRepeater x:Name="DashboardView" ItemsSource="{x:Bind ItemsSource, Mode=OneWay}"> 49 <ItemsRepeater.Layout> 50 <StackLayout Orientation="Vertical" Spacing="0" /> 51 </ItemsRepeater.Layout> 52 <ItemsRepeater.ItemTemplate> 53 <DataTemplate x:DataType="controls:ModuleListItem"> 54 <tkcontrols:SettingsCard 55 MinWidth="0" 56 MinHeight="0" 57 Padding="12,4,12,4" 58 tk:FrameworkElementExtensions.AncestorType="controls:ModuleList" 59 Background="Transparent" 60 BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}" 61 BorderThickness="{Binding (tk:FrameworkElementExtensions.Ancestor).DividerThickness, RelativeSource={RelativeSource Self}}" 62 Click="OnSettingsCardClick" 63 CornerRadius="0" 64 IsClickEnabled="{Binding (tk:FrameworkElementExtensions.Ancestor).IsItemClickable, RelativeSource={RelativeSource Self}}" 65 Tag="{x:Bind}"> 66 <tkcontrols:SettingsCard.Header> 67 <StackPanel Orientation="Horizontal"> 68 <TextBlock Text="{x:Bind Label, Mode=OneWay}" /> 69 <!-- InfoBadge --> 70 <InfoBadge 71 x:Name="NewInfoBadge" 72 Margin="4,0,0,0" 73 Style="{StaticResource NewInfoBadgeStyle}" 74 Visibility="{x:Bind IsNew, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" /> 75 <FontIcon 76 Width="20" 77 Margin="4,0,0,0" 78 FontSize="16" 79 Glyph="" 80 Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True}"> 81 <ToolTipService.ToolTip> 82 <TextBlock x:Uid="GPOWarning" TextWrapping="WrapWholeWords" /> 83 </ToolTipService.ToolTip> 84 </FontIcon> 85 </StackPanel> 86 </tkcontrols:SettingsCard.Header> 87 88 <tkcontrols:SettingsCard.HeaderIcon> 89 <ImageIcon> 90 <ImageIcon.Source> 91 <BitmapImage UriSource="{x:Bind Icon, Mode=OneWay}" /> 92 </ImageIcon.Source> 93 </ImageIcon> 94 </tkcontrols:SettingsCard.HeaderIcon> 95 96 <ToggleSwitch 97 HorizontalAlignment="Right" 98 AutomationProperties.Name="{x:Bind Label, Mode=OneWay}" 99 IsEnabled="{x:Bind IsLocked, Converter={StaticResource BoolNegationConverter}, ConverterParameter=True, Mode=OneWay}" 100 IsOn="{x:Bind IsEnabled, Mode=TwoWay}" 101 OffContent="" 102 OnContent="" /> 103 </tkcontrols:SettingsCard> 104 </DataTemplate> 105 </ItemsRepeater.ItemTemplate> 106 </ItemsRepeater> 107 </UserControl>