mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
More changes
This commit is contained in:
@@ -29,12 +29,13 @@
|
|||||||
<Button
|
<Button
|
||||||
x:Uid="Dashboard_SortBy"
|
x:Uid="Dashboard_SortBy"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
Style="{StaticResource SubtleButtonStyle}">
|
Style="{StaticResource SubtleButtonStyle}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<TextBlock x:Uid="Dashboard_SortBy_ToolTip" />
|
<TextBlock x:Uid="Dashboard_SortBy_ToolTip" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<FontIcon FontSize="16" Glyph="" />
|
<FontIcon FontSize="14" Glyph="" />
|
||||||
</Button.Content>
|
</Button.Content>
|
||||||
<Button.Flyout>
|
<Button.Flyout>
|
||||||
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
<MenuFlyout Placement="BottomEdgeAlignedRight">
|
||||||
@@ -70,10 +71,12 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid Grid.Row="1">
|
<Grid Grid.Row="1">
|
||||||
<ScrollViewer
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
<controls:ModuleList
|
||||||
VerticalScrollBarVisibility="Auto">
|
Margin="8,0,12,0"
|
||||||
<controls:ModuleList IsItemClickable="False" ItemsSource="{x:Bind ViewModel.FlyoutMenuItems, Mode=OneWay}" />
|
DividerThickness="0,0,0,0"
|
||||||
|
IsItemClickable="False"
|
||||||
|
ItemsSource="{x:Bind ViewModel.FlyoutMenuItems, Mode=OneWay}" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:winuiEx="using:WinUIEx"
|
xmlns:winuiEx="using:WinUIEx"
|
||||||
Title="PowerToys Quick Access (Preview)"
|
Title="PowerToys Quick Access (Preview)"
|
||||||
Width="386"
|
Width="400"
|
||||||
Height="516"
|
Height="516"
|
||||||
MinWidth="386"
|
MinWidth="400"
|
||||||
MinHeight="516"
|
MinHeight="516"
|
||||||
IsAlwaysOnTop="True"
|
IsAlwaysOnTop="True"
|
||||||
IsMaximizable="False"
|
IsMaximizable="False"
|
||||||
|
|||||||
@@ -45,101 +45,63 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
<ItemsRepeater x:Name="DashboardView" ItemsSource="{x:Bind ItemsSource, Mode=OneWay}">
|
||||||
|
<ItemsRepeater.Layout>
|
||||||
|
<StackLayout Orientation="Vertical" Spacing="0" />
|
||||||
|
</ItemsRepeater.Layout>
|
||||||
|
<ItemsRepeater.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="controls:ModuleListItem">
|
||||||
|
<tkcontrols:SettingsCard
|
||||||
|
MinWidth="0"
|
||||||
|
MinHeight="0"
|
||||||
|
Padding="12,4,12,4"
|
||||||
|
tk:FrameworkElementExtensions.AncestorType="controls:ModuleList"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
|
||||||
|
BorderThickness="{Binding (tk:FrameworkElementExtensions.Ancestor).DividerThickness, RelativeSource={RelativeSource Self}}"
|
||||||
|
Click="OnSettingsCardClick"
|
||||||
|
CornerRadius="0"
|
||||||
|
IsClickEnabled="{Binding (tk:FrameworkElementExtensions.Ancestor).IsItemClickable, RelativeSource={RelativeSource Self}}"
|
||||||
|
Tag="{x:Bind}">
|
||||||
|
<tkcontrols:SettingsCard.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{x:Bind Label, Mode=OneWay}" />
|
||||||
|
<!-- InfoBadge -->
|
||||||
|
<InfoBadge
|
||||||
|
x:Name="NewInfoBadge"
|
||||||
|
Margin="4,0,0,0"
|
||||||
|
Style="{StaticResource NewInfoBadgeStyle}"
|
||||||
|
Visibility="{x:Bind IsNew, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||||
|
<FontIcon
|
||||||
|
Width="20"
|
||||||
|
Margin="4,0,0,0"
|
||||||
|
FontSize="16"
|
||||||
|
Glyph=""
|
||||||
|
Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True}">
|
||||||
|
<ToolTipService.ToolTip>
|
||||||
|
<TextBlock x:Uid="GPOWarning" TextWrapping="WrapWholeWords" />
|
||||||
|
</ToolTipService.ToolTip>
|
||||||
|
</FontIcon>
|
||||||
|
</StackPanel>
|
||||||
|
</tkcontrols:SettingsCard.Header>
|
||||||
|
|
||||||
<controls:Card
|
<tkcontrols:SettingsCard.HeaderIcon>
|
||||||
x:Name="ModulesCard"
|
<ImageIcon>
|
||||||
Title="{x:Bind Title, Mode=OneWay}"
|
<ImageIcon.Source>
|
||||||
MinWidth="400"
|
<BitmapImage UriSource="{x:Bind Icon, Mode=OneWay}" />
|
||||||
Padding="0"
|
</ImageIcon.Source>
|
||||||
VerticalAlignment="Top"
|
</ImageIcon>
|
||||||
DividerVisibility="Collapsed">
|
</tkcontrols:SettingsCard.HeaderIcon>
|
||||||
<controls:Card.TitleContent>
|
|
||||||
<Button
|
|
||||||
x:Uid="Dashboard_SortBy"
|
|
||||||
Margin="0,0,4,0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Style="{StaticResource SubtleButtonStyle}">
|
|
||||||
<ToolTipService.ToolTip>
|
|
||||||
<TextBlock x:Uid="Dashboard_SortBy_ToolTip" />
|
|
||||||
</ToolTipService.ToolTip>
|
|
||||||
<Button.Content>
|
|
||||||
<FontIcon FontSize="16" Glyph="" />
|
|
||||||
</Button.Content>
|
|
||||||
<Button.Flyout>
|
|
||||||
<MenuFlyout>
|
|
||||||
<ToggleMenuFlyoutItem
|
|
||||||
x:Uid="Dashboard_SortAlphabetical"
|
|
||||||
Click="SortAlphabetical_Click"
|
|
||||||
IsChecked="{x:Bind SortOption, Mode=OneWay, Converter={StaticResource ModuleListSortOptionToBooleanConverter}, ConverterParameter=Alphabetical}" />
|
|
||||||
<ToggleMenuFlyoutItem
|
|
||||||
x:Uid="Dashboard_SortByStatus"
|
|
||||||
Click="SortByStatus_Click"
|
|
||||||
IsChecked="{x:Bind SortOption, Mode=OneWay, Converter={StaticResource ModuleListSortOptionToBooleanConverter}, ConverterParameter=ByStatus}" />
|
|
||||||
</MenuFlyout>
|
|
||||||
</Button.Flyout>
|
|
||||||
</Button>
|
|
||||||
</controls:Card.TitleContent>
|
|
||||||
|
|
||||||
<ItemsRepeater
|
<ToggleSwitch
|
||||||
x:Name="DashboardView"
|
HorizontalAlignment="Right"
|
||||||
Grid.Row="1"
|
AutomationProperties.Name="{x:Bind Label, Mode=OneWay}"
|
||||||
ItemsSource="{x:Bind ItemsSource, Mode=OneWay}">
|
IsEnabled="{x:Bind IsLocked, Converter={StaticResource BoolNegationConverter}, ConverterParameter=True, Mode=OneWay}"
|
||||||
<ItemsRepeater.Layout>
|
IsOn="{x:Bind IsEnabled, Mode=TwoWay}"
|
||||||
<StackLayout Orientation="Vertical" Spacing="0" />
|
OffContent=""
|
||||||
</ItemsRepeater.Layout>
|
OnContent="" />
|
||||||
<ItemsRepeater.ItemTemplate>
|
</tkcontrols:SettingsCard>
|
||||||
<DataTemplate x:DataType="controls:ModuleListItem">
|
</DataTemplate>
|
||||||
<tkcontrols:SettingsCard
|
</ItemsRepeater.ItemTemplate>
|
||||||
MinHeight="0"
|
</ItemsRepeater>
|
||||||
Padding="12,4,12,4"
|
|
||||||
tk:FrameworkElementExtensions.AncestorType="controls:ModuleList"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
|
|
||||||
BorderThickness="0,1,0,0"
|
|
||||||
Click="OnSettingsCardClick"
|
|
||||||
CornerRadius="0"
|
|
||||||
IsClickEnabled="{Binding (tk:FrameworkElementExtensions.Ancestor).IsItemClickable, RelativeSource={RelativeSource Self}}"
|
|
||||||
Tag="{x:Bind}">
|
|
||||||
<tkcontrols:SettingsCard.Header>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Text="{x:Bind Label, Mode=OneWay}" />
|
|
||||||
<!-- InfoBadge -->
|
|
||||||
<InfoBadge
|
|
||||||
x:Name="NewInfoBadge"
|
|
||||||
Margin="4,0,0,0"
|
|
||||||
Style="{StaticResource NewInfoBadgeStyle}"
|
|
||||||
Visibility="{x:Bind IsNew, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
|
||||||
<FontIcon
|
|
||||||
Width="20"
|
|
||||||
Margin="4,0,0,0"
|
|
||||||
FontSize="16"
|
|
||||||
Glyph=""
|
|
||||||
Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True}">
|
|
||||||
<ToolTipService.ToolTip>
|
|
||||||
<TextBlock x:Uid="GPOWarning" TextWrapping="WrapWholeWords" />
|
|
||||||
</ToolTipService.ToolTip>
|
|
||||||
</FontIcon>
|
|
||||||
</StackPanel>
|
|
||||||
</tkcontrols:SettingsCard.Header>
|
|
||||||
|
|
||||||
<tkcontrols:SettingsCard.HeaderIcon>
|
|
||||||
<ImageIcon>
|
|
||||||
<ImageIcon.Source>
|
|
||||||
<BitmapImage UriSource="{x:Bind Icon, Mode=OneWay}" />
|
|
||||||
</ImageIcon.Source>
|
|
||||||
</ImageIcon>
|
|
||||||
</tkcontrols:SettingsCard.HeaderIcon>
|
|
||||||
|
|
||||||
<ToggleSwitch
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
AutomationProperties.Name="{x:Bind Label, Mode=OneWay}"
|
|
||||||
IsEnabled="{x:Bind IsLocked, Converter={StaticResource BoolNegationConverter}, ConverterParameter=True, Mode=OneWay}"
|
|
||||||
IsOn="{x:Bind IsEnabled, Mode=TwoWay}"
|
|
||||||
OffContent=""
|
|
||||||
OnContent="" />
|
|
||||||
</tkcontrols:SettingsCard>
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsRepeater.ItemTemplate>
|
|
||||||
</ItemsRepeater>
|
|
||||||
</controls:Card>
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -9,15 +9,19 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
|||||||
{
|
{
|
||||||
public sealed partial class ModuleList : UserControl
|
public sealed partial class ModuleList : UserControl
|
||||||
{
|
{
|
||||||
private object? _sortButton;
|
|
||||||
|
|
||||||
public ModuleList()
|
public ModuleList()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
_sortButton = ModulesCard.TitleContent;
|
|
||||||
UpdateHeaderVisibility();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Thickness DividerThickness
|
||||||
|
{
|
||||||
|
get => (Thickness)GetValue(DividerThicknessProperty);
|
||||||
|
set => SetValue(DividerThicknessProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty DividerThicknessProperty = DependencyProperty.Register(nameof(DividerThickness), typeof(Thickness), typeof(ModuleList), new PropertyMetadata(new Thickness(0, 1, 0, 0)));
|
||||||
|
|
||||||
public bool IsItemClickable
|
public bool IsItemClickable
|
||||||
{
|
{
|
||||||
get => (bool)GetValue(IsItemClickableProperty);
|
get => (bool)GetValue(IsItemClickableProperty);
|
||||||
@@ -42,46 +46,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
|||||||
|
|
||||||
public static readonly DependencyProperty SortOptionProperty = DependencyProperty.Register(nameof(SortOption), typeof(ModuleListSortOption), typeof(ModuleList), new PropertyMetadata(ModuleListSortOption.Alphabetical));
|
public static readonly DependencyProperty SortOptionProperty = DependencyProperty.Register(nameof(SortOption), typeof(ModuleListSortOption), typeof(ModuleList), new PropertyMetadata(ModuleListSortOption.Alphabetical));
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get => (string)GetValue(TitleProperty);
|
|
||||||
set => SetValue(TitleProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(ModuleList), new PropertyMetadata(default(string), OnTitleChanged));
|
|
||||||
|
|
||||||
private static void OnTitleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
||||||
{
|
|
||||||
((ModuleList)d).UpdateHeaderVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateHeaderVisibility()
|
|
||||||
{
|
|
||||||
if (ModulesCard == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Title))
|
|
||||||
{
|
|
||||||
ModulesCard.TitleContent = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ModulesCard.TitleContent = _sortButton;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SortAlphabetical_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
SortOption = ModuleListSortOption.Alphabetical;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SortByStatus_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
SortOption = ModuleListSortOption.ByStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnSettingsCardClick(object sender, RoutedEventArgs e)
|
private void OnSettingsCardClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is FrameworkElement element && element.Tag is ModuleListItem item)
|
if (sender is FrameworkElement element && element.Tag is ModuleListItem item)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
|||||||
set => SetValue(ContentProperty, value);
|
set => SetValue(ContentProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty DividerVisibilityProperty = DependencyProperty.Register(nameof(DividerVisibility), typeof(Visibility), typeof(Card), new PropertyMetadata(defaultValue: null));
|
public static readonly DependencyProperty DividerVisibilityProperty = DependencyProperty.Register(nameof(DividerVisibility), typeof(Visibility), typeof(Card), new PropertyMetadata(defaultValue: Visibility.Visible));
|
||||||
|
|
||||||
public Visibility DividerVisibility
|
public Visibility DividerVisibility
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
VisualStateManager.GoToState(this, "TitleGridVisible", true);
|
VisualStateManager.GoToState(this, "TitleGridVisible", true);
|
||||||
DividerVisibility = Visibility.Visible;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,14 +224,46 @@
|
|||||||
Visibility="{x:Bind ViewModel.ShortcutModules.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" />
|
Visibility="{x:Bind ViewModel.ShortcutModules.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</controls:Card>
|
</controls:Card>
|
||||||
<controls:ModuleList
|
<controls:Card
|
||||||
x:Name="ModulesCard"
|
|
||||||
x:Uid="UtilitiesHeader"
|
x:Uid="UtilitiesHeader"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
MinWidth="400"
|
||||||
|
Padding="0"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
ItemsSource="{x:Bind ViewModel.AllModules, Mode=OneWay}"
|
DividerVisibility="Collapsed">
|
||||||
SortOption="{x:Bind ViewModel.DashboardSortOrder, Mode=TwoWay, Converter={StaticResource EnumToModuleListSortOptionConverter}}" />
|
<controls:Card.TitleContent>
|
||||||
|
<Button
|
||||||
|
x:Uid="Dashboard_SortBy"
|
||||||
|
Margin="0,0,4,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource SubtleButtonStyle}">
|
||||||
|
<ToolTipService.ToolTip>
|
||||||
|
<TextBlock x:Uid="Dashboard_SortBy_ToolTip" />
|
||||||
|
</ToolTipService.ToolTip>
|
||||||
|
<Button.Content>
|
||||||
|
<FontIcon FontSize="16" Glyph="" />
|
||||||
|
</Button.Content>
|
||||||
|
<Button.Flyout>
|
||||||
|
<MenuFlyout>
|
||||||
|
<ToggleMenuFlyoutItem
|
||||||
|
x:Uid="Dashboard_SortAlphabetical"
|
||||||
|
Click="SortAlphabetical_Click"
|
||||||
|
IsChecked="{x:Bind ViewModel.DashboardSortOrder, Mode=OneWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Alphabetical}" />
|
||||||
|
<ToggleMenuFlyoutItem
|
||||||
|
x:Uid="Dashboard_SortByStatus"
|
||||||
|
Click="SortByStatus_Click"
|
||||||
|
IsChecked="{x:Bind ViewModel.DashboardSortOrder, Mode=OneWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=ByStatus}" />
|
||||||
|
</MenuFlyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
</controls:Card.TitleContent>
|
||||||
|
<controls:ModuleList
|
||||||
|
x:Name="ModulesCard"
|
||||||
|
Grid.Row="1"
|
||||||
|
ItemsSource="{x:Bind ViewModel.AllModules, Mode=OneWay}"
|
||||||
|
SortOption="{x:Bind ViewModel.DashboardSortOrder, Mode=TwoWay, Converter={StaticResource EnumToModuleListSortOptionConverter}}" />
|
||||||
|
</controls:Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|||||||
@@ -61,5 +61,15 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
|||||||
|
|
||||||
App.GetOobeWindow().Activate();
|
App.GetOobeWindow().Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SortAlphabetical_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.DashboardSortOrder = DashboardSortOrder.Alphabetical;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SortByStatus_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.DashboardSortOrder = DashboardSortOrder.ByStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user