Adds automatic column resizing to ListViews

- Enables automatic horizontal and vertical scrollbars for ListViews in the UI to improve navigation.
- Introduces functions to dynamically calculate and apply column widths based on the visible content and header text.
- Triggers column auto-resizing across various modules whenever ListView data is updated or refreshed.
- Renames a path normalization function and updates an event handler parameter name for clarity.
This commit is contained in:
rbalsleyMSFT
2026-03-24 16:28:29 -07:00
parent bae29fd9c7
commit d6361dac4d
9 changed files with 251 additions and 8 deletions
@@ -24,7 +24,7 @@ function Register-EventHandlers {
# Define a handler to validate pasted text, ensuring it's only integers
$integerPastingHandler = {
param($sender, $pastingEventArgs)
param($eventSource, $pastingEventArgs)
if ($pastingEventArgs.DataObject.GetDataPresent([string])) {
$pastedText = $pastingEventArgs.DataObject.GetData([string])
# Check if the pasted text consists ONLY of one or more digits.
@@ -345,6 +345,7 @@ function Register-EventHandlers {
$driveObject | Add-Member -MemberType NoteProperty -Name 'IsSelected' -Value $false -Force
$localState.Controls.lstUSBDrives.Items.Add($driveObject)
}
Request-ListViewColumnAutoResize -ListView $localState.Controls.lstUSBDrives
if ($localState.Controls.lstUSBDrives.Items.Count -gt 0) {
$localState.Controls.lstUSBDrives.SelectedIndex = 0
}