mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-07-16 00:40:39 +00:00
fix: make tweak/feature link (?) follow font scaling (#4700)
* Update Invoke-WPFUIElements.ps1 * Update Invoke-WPFUIElements.ps1 * Update Invoke-WPFUIElements.ps1 Update Invoke-WPFUIElements.ps1 * Fix tweak link margin scaling --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
@@ -404,6 +404,27 @@ function Invoke-WPFUIElements {
|
||||
$textBlock.ToolTip = $entryInfo.Link
|
||||
$textBlock.Style = $HoverTextBlockStyle
|
||||
$textBlock.UseLayoutRounding = $true
|
||||
|
||||
$textBlock.VerticalAlignment = "Center"
|
||||
$textBlock.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize")
|
||||
$textBlock.Tag = $checkBox
|
||||
|
||||
$updateLinkMargin = {
|
||||
[System.Object]$Sender = $args[0]
|
||||
$linkedCheckBox = $Sender.Tag
|
||||
$MarginTopBase = if ($linkedCheckBox) { $linkedCheckBox.Margin.Top } else { 0 }
|
||||
$Sender.Margin = New-Object Windows.Thickness(
|
||||
[math]::Round($Sender.FontSize * 0.5),
|
||||
($MarginTopBase - [math]::Round($Sender.FontSize / 2)),
|
||||
0, 0
|
||||
)
|
||||
}
|
||||
$textBlock.Add_Loaded($updateLinkMargin)
|
||||
$fontSizeDescriptor = [System.ComponentModel.DependencyPropertyDescriptor]::FromProperty(
|
||||
[Windows.Controls.Control]::FontSizeProperty,
|
||||
[Windows.Controls.TextBlock]
|
||||
)
|
||||
$fontSizeDescriptor.AddValueChanged($textBlock, $updateLinkMargin)
|
||||
|
||||
$horizontalStackPanel.Children.Add($textBlock) | Out-Null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user