Skip to content

Commit 007995c

Browse files
Improve install app card UI (ChrisTitusTech#4771)
Co-authored-by: Chris Titus <contact@christitus.com>
1 parent 0dcd361 commit 007995c

3 files changed

Lines changed: 36 additions & 31 deletions

File tree

config/themes.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"shared": {
3-
"AppEntryWidth": "200",
4-
"AppEntryFontSize": "11",
5-
"AppEntryMargin": "1,0,1,0",
6-
"AppEntryBorderThickness": "0",
3+
"AppEntryWidth": "220",
4+
"AppEntryFontSize": "13.2",
5+
"AppEntryIconSize": "28",
6+
"AppEntryMargin": "3",
7+
"AppEntryBorderThickness": "1",
78
"CustomDialogFontSize": "12",
89
"CustomDialogFontSizeHeader": "14",
910
"CustomDialogLogoSize": "25",

functions/private/Initialize-InstallAppEntry.ps1

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,30 @@ function Initialize-InstallAppEntry {
6060
$borderElement.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
6161
})
6262

63+
$contentPanel = New-Object Windows.Controls.StackPanel
64+
$contentPanel.Orientation = "Horizontal"
65+
$contentPanel.VerticalAlignment = [Windows.VerticalAlignment]::Center
66+
67+
$icon = New-Object Windows.Controls.Grid
68+
$icon.SetResourceReference([Windows.FrameworkElement]::WidthProperty, "AppEntryIconSize")
69+
$icon.SetResourceReference([Windows.FrameworkElement]::HeightProperty, "AppEntryIconSize")
70+
$icon.Margin = New-Object Windows.Thickness(0, 0, 8, 0)
71+
$fallback = New-Object Windows.Controls.TextBlock
72+
$fallback.Text = $Apps.$appKey.content.TrimStart(".").Substring(0, 1).ToUpper()
73+
$fallback.FontWeight = "Bold"; $fallback.HorizontalAlignment = "Center"; $fallback.VerticalAlignment = "Center"
74+
if ($Apps.$appKey.link) { $fallback.Visibility = "Collapsed" }
75+
$fallback.SetResourceReference([Windows.Controls.TextBlock]::FontSizeProperty, "AppEntryFontSize")
76+
$fallback.SetResourceReference([Windows.Controls.TextBlock]::ForegroundProperty, "ToggleButtonOnColor")
77+
[void]$icon.Children.Add($fallback)
78+
if ($Apps.$appKey.link) {
79+
$logo = New-Object Windows.Controls.Image
80+
$logo.Stretch = [Windows.Media.Stretch]::Uniform
81+
$logo.Source = "https://www.google.com/s2/favicons?sz=64&domain_url=$([uri]::EscapeDataString($Apps.$appKey.link))"
82+
$logo.Add_ImageFailed({ $this.Visibility = "Collapsed"; $this.Parent.Children[0].Visibility = "Visible" })
83+
[void]$icon.Children.Add($logo)
84+
}
85+
[void]$contentPanel.Children.Add($icon)
86+
6387
# Create the TextBlock for the application name
6488
$appName = New-Object Windows.Controls.TextBlock
6589
$appName.Style = $sync.Form.Resources.AppEntryNameStyle
@@ -73,7 +97,8 @@ function Initialize-InstallAppEntry {
7397

7498
[void]$appName.Inlines.Add($fossRun)
7599
}
76-
$checkBox.Content = $appName
100+
[void]$contentPanel.Children.Add($appName)
101+
$checkBox.Content = $contentPanel
77102

78103
# Add accessibility properties to make the elements screen reader friendly
79104
$checkBox.SetValue([Windows.Automation.AutomationProperties]::NameProperty, $app.content)

xaml/inputXML.xaml

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
<Style x:Key="AppEntryBorderStyle" TargetType="Border">
8585
<Setter Property="BorderBrush" Value="Gray"/>
8686
<Setter Property="BorderThickness" Value="{DynamicResource AppEntryBorderThickness}"/>
87-
<Setter Property="CornerRadius" Value="2"/>
88-
<Setter Property="Padding" Value="{DynamicResource AppEntryMargin}"/>
87+
<Setter Property="CornerRadius" Value="5"/>
88+
<Setter Property="Padding" Value="6,4"/>
8989
<Setter Property="Width" Value="{DynamicResource AppEntryWidth}"/>
9090
<Setter Property="VerticalAlignment" Value="Top"/>
9191
<Setter Property="Margin" Value="{DynamicResource AppEntryMargin}"/>
@@ -100,30 +100,9 @@
100100
<Setter Property="Template">
101101
<Setter.Value>
102102
<ControlTemplate TargetType="CheckBox">
103-
<StackPanel Orientation="Horizontal">
104-
<Grid Width="16" Height="16" Margin="0,0,8,0">
105-
<Border Name="CheckBoxBorder"
106-
BorderBrush="{DynamicResource MainForegroundColor}"
107-
Background="{DynamicResource ButtonBackgroundColor}"
108-
BorderThickness="1"
109-
Width="12"
110-
Height="12"
111-
CornerRadius="2"/>
112-
<Path Name="CheckMark"
113-
Stroke="{DynamicResource ToggleButtonOnColor}"
114-
StrokeThickness="2"
115-
Data="M 2 8 L 6 12 L 14 4"
116-
Visibility="Collapsed"/>
117-
</Grid>
118-
<ContentPresenter Content="{TemplateBinding Content}"
119-
VerticalAlignment="Center"
120-
HorizontalAlignment="Left"/>
121-
</StackPanel>
122-
<ControlTemplate.Triggers>
123-
<Trigger Property="IsChecked" Value="True">
124-
<Setter TargetName="CheckMark" Property="Visibility" Value="Visible"/>
125-
</Trigger>
126-
</ControlTemplate.Triggers>
103+
<ContentPresenter Content="{TemplateBinding Content}"
104+
VerticalAlignment="Center"
105+
HorizontalAlignment="Left"/>
127106
</ControlTemplate>
128107
</Setter.Value>
129108
</Setter>

0 commit comments

Comments
 (0)