mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-15 15:15:51 -06:00
32 lines
1.1 KiB
PowerShell
32 lines
1.1 KiB
PowerShell
function Invoke-WPFTab {
|
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Sets the selected tab to the tab that was clicked
|
|
|
|
.PARAMETER ClickedTab
|
|
The name of the tab that was clicked
|
|
|
|
#>
|
|
|
|
Param ($ClickedTab)
|
|
|
|
$tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"}
|
|
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
|
|
|
|
$filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"}
|
|
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
|
|
if ($ClickedTab -ne $PSItem.name) {
|
|
$sync[$PSItem.Name].IsChecked = $false
|
|
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
|
|
# $sync.$tabNav.Items[$tabNumber].IsSelected = $false
|
|
} else {
|
|
$sync["$ClickedTab"].IsChecked = $true
|
|
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
|
|
$sync.$tabNav.Items[$tabNumber].IsSelected = $true
|
|
}
|
|
}
|
|
$sync.currentTab = $sync.$tabNav.Items[$tabNumber].Header
|
|
}
|