Skip to content

Commit

Permalink
Add visual selection and allow click on the whole app section
Browse files Browse the repository at this point in the history
  • Loading branch information
Marterich committed Oct 7, 2024
1 parent be97bcf commit 50e2fec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions config/themes.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"ButtonCornerRadius": "2"
},
"Light": {
"AppInstallUnselectedColor": "#F0F0F0",
"AppInstallSelectedColor": "#C2C2C2",
"ComboBoxForegroundColor": "#232629",
"ComboBoxBackgroundColor": "#F7F7F7",
"LabelboxForegroundColor": "#232629",
Expand Down Expand Up @@ -73,6 +75,8 @@

},
"Dark": {
"AppInstallUnselectedColor": "#232629",
"AppInstallSelectedColor": "#4C4C4C",
"ComboBoxForegroundColor": "#F7F7F7",
"ComboBoxBackgroundColor": "#1E3747",
"LabelboxForegroundColor": "#0567ff",
Expand Down
18 changes: 15 additions & 3 deletions functions/public/Invoke-WPFUIElements.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,17 @@ function Invoke-WPFUIElements {
$border.HorizontalAlignment = "Stretch"
$border.VerticalAlignment = "Top"
$border.Margin = New-Object Windows.Thickness(0, 10, 0, 0)

$border.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
$border.Add_MouseUp({
$childCheckbox = ($this.Child.Children | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0]
$childCheckBox.isChecked = -not $childCheckbox.IsChecked
if ($childCheckbox.isChecked){
$this.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallSelectedColor")
}
else{
$this.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "AppInstallUnselectedColor")
}
})
# Create a DockPanel inside the Border
$dockPanel = New-Object Windows.Controls.DockPanel
$dockPanel.LastChildFill = $true
Expand All @@ -241,6 +251,7 @@ function Invoke-WPFUIElements {
# Create the CheckBox, vertically centered
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $entryInfo.Name
$checkBox.Background = "Transparent"
$checkBox.HorizontalAlignment = "Left"
$checkBox.VerticalAlignment = "Center"
$checkBox.Margin = New-Object Windows.Thickness(5, 0, 10, 0)
Expand Down Expand Up @@ -279,15 +290,16 @@ function Invoke-WPFUIElements {
$appName.FontWeight = [Windows.FontWeights]::Bold
$appName.VerticalAlignment = "Center"
$appName.Margin = New-Object Windows.Thickness(5, 0, 0, 0)
$appName.Background = "Transparent"
$imageAndNamePanel.Children.Add($appName) | Out-Null

# Add the image and name panel to the Checkbox
$checkBox.Content = $imageAndNamePanel

# Add the checkbox to the DockPanel
[Windows.Controls.DockPanel]::SetDock($checkBox, [Windows.Controls.Dock]::Left)
$dockPanel.Children.Add($checkBox) | Out-Null

# Create the StackPanel for the buttons and dock it to the right
$buttonPanel = New-Object Windows.Controls.StackPanel
$buttonPanel.Orientation = "Horizontal"
Expand Down

0 comments on commit 50e2fec

Please sign in to comment.