Skip to content

Commit

Permalink
[FLS] Icon and UI fixes (#21732)
Browse files Browse the repository at this point in the history
* Fixes

* Additional fixes

* Uncomment TextBlock that's needed

* Remove ItemsPanelTemplate that was turning off virtualization
  • Loading branch information
niels9001 authored and jaimecbernardo committed Nov 7, 2022
1 parent d1794e2 commit 081cd3b
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.0" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.2" />
<PackageReference Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.7" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.5" />
Expand Down
193 changes: 111 additions & 82 deletions src/modules/FileLocksmith/FileLocksmithUI/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:interop="using:FileLocksmith.Interop"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:local="using:PowerToys.FileLocksmithUI.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkitConverters="using:CommunityToolkit.WinUI.UI.Converters"
mc:Ignorable="d">
Expand Down Expand Up @@ -41,23 +40,28 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<Grid Padding="18,0,18,4" VerticalAlignment="Bottom">
<!--<TextBlock Margin="0,2,0,0" Text="Current proccesses:" Style="{ThemeResource BodyStrongTextBlockStyle}"/>-->
<Button Content="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}" Click="ShowSelectedPathsButton_Click">
<Grid
Padding="18,0,18,4"
VerticalAlignment="Bottom">
<Button
Click="ShowSelectedPathsButton_Click"
Content="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}">
<Button.Template>
<ControlTemplate TargetType="Button">
<TextBlock Margin="0,8,0,0"
<TextBlock
Margin="0,8,0,0"
HorizontalAlignment="Left"
Style="{ThemeResource BodyStrongTextBlockStyle}"
Text="{TemplateBinding Content}" >
</TextBlock>
Text="{TemplateBinding Content}" />
</ControlTemplate>
</Button.Template>
<ToolTipService.ToolTip>
<TextBlock x:Uid="PathsTooltipDescription" TextWrapping="WrapWholeWords"/>
<TextBlock
x:Uid="PathsTooltipDescription"
TextWrapping="WrapWholeWords" />
</ToolTipService.ToolTip>
</Button>

<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Expand All @@ -71,7 +75,7 @@
<FontIcon
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Glyph="&#xE149;" />
Glyph="&#xe72c;" />
<ToolTipService.ToolTip>
<TextBlock x:Uid="Reload" />
</ToolTipService.ToolTip>
Expand All @@ -85,7 +89,7 @@
<FontIcon
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Glyph="&#xE1A7;" />
Glyph="&#xe7ef;" />
<ToolTipService.ToolTip>
<TextBlock x:Uid="RestartAsAdmin" />
</ToolTipService.ToolTip>
Expand All @@ -98,87 +102,101 @@
<ListView
x:Name="ProcessesListView"
Grid.Row="1"
ItemsSource="{x:Bind ViewModel.Processes}"
IncrementalLoadingThreshold="10"
ItemsSource="{x:Bind ViewModel.Processes}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="interop:ProcessResult">
<labs:SettingsExpander Margin="0,3,0,0">
<labs:SettingsExpander.Header>
<!-- We can't use the HeaderIcon because it only support a BitmapIcon, which only supports UriSource - not a direct BitmapImage -->
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Margin="2,0,24,0"
Source="{x:Bind pid, Converter={StaticResource pidToIconConverter}}" />
<TextBlock IsTextSelectionEnabled="True" Text="{x:Bind name}" />
</StackPanel>
</labs:SettingsExpander.Header>
<labs:SettingsExpander.Content>
<labs:SettingsExpander Margin="0,3,0,0">
<labs:SettingsExpander.Resources>
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
</labs:SettingsExpander.Resources>
<labs:SettingsExpander.Header>
<!-- We can't use the HeaderIcon because it only support a BitmapIcon, which only supports UriSource - not a direct BitmapImage -->
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Margin="2,0,24,0"
Source="{x:Bind pid, Converter={StaticResource pidToIconConverter}}" />
<TextBlock
IsTextSelectionEnabled="True"
Text="{x:Bind name}" />
</StackPanel>
</labs:SettingsExpander.Header>
<labs:SettingsExpander.Content>
<StackPanel
Orientation="Horizontal"
Spacing="8">
<FontIcon
Margin="0,0,8,0"
Glyph="&#xE7BA;"
Foreground="{ThemeResource InfoBarWarningSeverityIconBackground}"
Visibility="{x:Bind user, Mode=OneTime, Converter={StaticResource userToSystemWarningVisibilityConverter}}"
>
Glyph="&#xE7BA;"
Visibility="{x:Bind user, Mode=OneTime, Converter={StaticResource userToSystemWarningVisibilityConverter}}">
<ToolTipService.ToolTip>
<TextBlock TextWrapping="Wrap" x:Uid="ProcessIsSystemUserWarning" />
<TextBlock
x:Uid="ProcessIsSystemUserWarning"
TextWrapping="Wrap" />
</ToolTipService.ToolTip>
</FontIcon>
<Button Command="{Binding Path=DataContext.EndTaskCommand, ElementName=ProcessesListView}" CommandParameter="{Binding}">
<StackPanel Orientation="Horizontal" Spacing="6">
<Button
MinWidth="132"
Command="{Binding Path=DataContext.EndTaskCommand, ElementName=ProcessesListView}"
CommandParameter="{Binding}">
<StackPanel
Orientation="Horizontal"
Spacing="6">
<FontIcon
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="14"
Glyph="&#xf140;" />
<TextBlock x:Uid="EndTask" />
<TextBlock
x:Uid="EndTask"
FontSize="14" />
</StackPanel>
</Button>
</StackPanel>
</labs:SettingsExpander.Content>
<labs:SettingsExpander.Items>
<labs:SettingsCard x:Uid="ProcessID">
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Text="{x:Bind pid}" />
</labs:SettingsCard>
<labs:SettingsCard x:Uid="User">
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Text="{x:Bind user}" />
</labs:SettingsCard>
<labs:SettingsCard ContentAlignment="Vertical">
<labs:SettingsCard.Header>
<TextBlock>
<Run x:Uid="Files" />
<Run Text="(" /><Run Text="{x:Bind files, Converter={StaticResource fileCountConverter}}" /><Run Text=")" />
</TextBlock>
</labs:SettingsCard.Header>
<ListView
Margin="-16,0,0,0"
ItemsSource="{x:Bind files}"
SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate x:DataType="x:String">
<TextBlock
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap"
ToolTipService.ToolTip="{Binding}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
</labs:SettingsExpander.Content>
<labs:SettingsExpander.Items>
<labs:SettingsCard x:Uid="ProcessID">
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Text="{x:Bind pid}" />
</labs:SettingsCard>
<labs:SettingsCard x:Uid="User">
<TextBlock
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Text="{x:Bind user}" />
</labs:SettingsCard>
<labs:SettingsCard ContentAlignment="Vertical">
<labs:SettingsCard.Header>
<TextBlock>
<Run x:Uid="Files" />
<Run Text="(" /><Run Text="{x:Bind files, Converter={StaticResource fileCountConverter}}" /><Run Text=")" />
</TextBlock>
</labs:SettingsCard.Header>
<ItemsRepeater
Margin="-16,0,0,0"
ItemsSource="{x:Bind files}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="x:String">
<TextBlock
Margin="16,0,0,4"
FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
IsTextSelectionEnabled="True"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{Binding}"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap"
ToolTipService.ToolTip="{Binding}" />
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Expand All @@ -188,17 +206,23 @@
Orientation="Vertical"
Spacing="8"
Visibility="{x:Bind ViewModel.Processes.Count, Mode=OneWay, Converter={StaticResource doubleToVisibilityConverter}}">
<Button HorizontalAlignment="Center" Command="{Binding LoadProcessesCommand}" >
<Button
HorizontalAlignment="Center"
Command="{Binding LoadProcessesCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
<FontIcon FontSize="32" Glyph="&#xE9F3;" />
<FontIcon
FontSize="32"
Glyph="&#xE9F3;" />
</ControlTemplate>
</Button.Template>
<ToolTipService.ToolTip>
<TextBlock x:Uid="Reload" />
</ToolTipService.ToolTip>
</Button>
<TextBlock x:Uid="EmptyListDescription" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<TextBlock
x:Uid="EmptyListDescription"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
</StackPanel>
</Grid>
<ProgressRing
Expand All @@ -208,10 +232,15 @@
</Grid>
<ContentDialog
x:Name="SelectedFilesListDialog"
x:Uid="SelectedFilesListDialog"
>
<ScrollViewer HorizontalScrollBarVisibility="Auto" HorizontalScrollMode="Auto" VerticalScrollBarVisibility="Auto" VerticalScrollMode="Auto">
<TextBlock IsTextSelectionEnabled="True" Text="{x:Bind ViewModel.PathsToString, Mode=OneWay}"/>
x:Uid="SelectedFilesListDialog">
<ScrollViewer
HorizontalScrollBarVisibility="Auto"
HorizontalScrollMode="Auto"
VerticalScrollBarVisibility="Auto"
VerticalScrollMode="Auto">
<TextBlock
IsTextSelectionEnabled="True"
Text="{x:Bind ViewModel.PathsToString, Mode=OneWay}" />
</ScrollViewer>
</ContentDialog>
</Grid>
Expand Down

0 comments on commit 081cd3b

Please sign in to comment.