Improves UI structure with a shared page shell and dynamic titles

Wraps the application's content area in a stylized border and introduces a centralized, dynamic page header to provide a more cohesive look.

- Adds `Tag` attributes to navigation list items to define each view's display title
- Implements event handlers to automatically update the header text based on user navigation
- Removes redundant embedded titles from individual content pages to streamline the layouts
This commit is contained in:
rbalsleyMSFT
2026-03-23 11:52:04 -07:00
parent 002017e5e6
commit 98c1644d76
3 changed files with 812 additions and 765 deletions
File diff suppressed because it is too large Load Diff
@@ -117,6 +117,14 @@ function Register-EventHandlers {
if ($selectedIndex -lt $localState.Controls.navigationPages.Count) {
$localState.Controls.navigationPages[$selectedIndex].Visibility = 'Visible'
}
# Update the shared page title to match the selected navigation item
if ($null -ne $localState.Controls.txtPageTitle) {
$selectedNavigationItem = $eventSource.SelectedItem
if ($null -ne $selectedNavigationItem -and -not [string]::IsNullOrWhiteSpace([string]$selectedNavigationItem.Tag)) {
$localState.Controls.txtPageTitle.Text = [string]$selectedNavigationItem.Tag
}
}
})
}
@@ -145,6 +153,17 @@ function Register-EventHandlers {
if ($null -ne $localState.Controls.pageSettings) {
$localState.Controls.pageSettings.Visibility = 'Visible'
}
# Update the shared page title to match the selected navigation item
if ($null -ne $localState.Controls.txtPageTitle) {
$selectedNavigationItem = $eventSource.SelectedItem
if ($null -ne $selectedNavigationItem -and -not [string]::IsNullOrWhiteSpace([string]$selectedNavigationItem.Tag)) {
$localState.Controls.txtPageTitle.Text = [string]$selectedNavigationItem.Tag
}
else {
$localState.Controls.txtPageTitle.Text = 'Settings'
}
}
})
}
@@ -280,6 +280,9 @@ function Initialize-UIControls {
# Settings page
$State.Controls.cmbThemeMode = $window.FindName('cmbThemeMode')
# Shared page shell
$State.Controls.txtPageTitle = $window.FindName('txtPageTitle')
# Navigation controls
$State.Controls.lstNavigation = $window.FindName('lstNavigation')
$State.Controls.lstNavSettings = $window.FindName('lstNavSettings')
@@ -473,9 +476,20 @@ function Initialize-UIDefaults {
}
}
# Set default navigation selection to Home and show the Home page
# Set default navigation selection to Home and initialize the shared page title
if ($null -ne $State.Controls.lstNavigation) {
$State.Controls.lstNavigation.SelectedIndex = 0
# Keep the shell header aligned with the selected navigation item on first render
if ($null -ne $State.Controls.txtPageTitle) {
$selectedNavigationItem = $State.Controls.lstNavigation.SelectedItem
if ($null -ne $selectedNavigationItem -and -not [string]::IsNullOrWhiteSpace([string]$selectedNavigationItem.Tag)) {
$State.Controls.txtPageTitle.Text = [string]$selectedNavigationItem.Tag
}
else {
$State.Controls.txtPageTitle.Text = 'Home'
}
}
}
# Set initial state for Office panel visibility