mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-04-01 17:12:09 +00:00
remove scrollviewer from WPFUIElements
This commit is contained in:
parent
df29188f1e
commit
6b5db60ce7
@ -114,19 +114,11 @@ function Invoke-WPFUIElements {
|
|||||||
$border.style = $borderstyle
|
$border.style = $borderstyle
|
||||||
$targetGrid.Children.Add($border) | Out-Null
|
$targetGrid.Children.Add($border) | Out-Null
|
||||||
|
|
||||||
# Use a DockPanel to contain both the top buttons and the main content
|
# Use a DockPanel to contain the content
|
||||||
$dockPanelContainer = New-Object Windows.Controls.DockPanel
|
$dockPanelContainer = New-Object Windows.Controls.DockPanel
|
||||||
$border.Child = $dockPanelContainer
|
$border.Child = $dockPanelContainer
|
||||||
|
|
||||||
# Create a ScrollViewer to contain the main content (excluding buttons)
|
# Create an ItemsControl for application content
|
||||||
$scrollViewer = New-Object Windows.Controls.ScrollViewer
|
|
||||||
$scrollViewer.VerticalScrollBarVisibility = 'Auto'
|
|
||||||
$scrollViewer.HorizontalScrollBarVisibility = 'Auto'
|
|
||||||
$scrollViewer.HorizontalAlignment = 'Stretch'
|
|
||||||
$scrollViewer.VerticalAlignment = 'Stretch'
|
|
||||||
$scrollViewer.CanContentScroll = $true # Enable virtualization
|
|
||||||
|
|
||||||
# Create an ItemsControl inside the ScrollViewer for application content
|
|
||||||
$itemsControl = New-Object Windows.Controls.ItemsControl
|
$itemsControl = New-Object Windows.Controls.ItemsControl
|
||||||
$itemsControl.HorizontalAlignment = 'Stretch'
|
$itemsControl.HorizontalAlignment = 'Stretch'
|
||||||
$itemsControl.VerticalAlignment = 'Stretch'
|
$itemsControl.VerticalAlignment = 'Stretch'
|
||||||
@ -141,12 +133,9 @@ function Invoke-WPFUIElements {
|
|||||||
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::IsVirtualizingProperty, $true)
|
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::IsVirtualizingProperty, $true)
|
||||||
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::VirtualizationModeProperty, [Windows.Controls.VirtualizationMode]::Recycling)
|
$itemsControl.SetValue([Windows.Controls.VirtualizingStackPanel]::VirtualizationModeProperty, [Windows.Controls.VirtualizationMode]::Recycling)
|
||||||
|
|
||||||
# Add the ItemsControl to the ScrollViewer
|
# Add the ItemsControl directly to the DockPanel
|
||||||
$scrollViewer.Content = $itemsControl
|
[Windows.Controls.DockPanel]::SetDock($itemsControl, [Windows.Controls.Dock]::Bottom)
|
||||||
|
$dockPanelContainer.Children.Add($itemsControl) | Out-Null
|
||||||
# Add the ScrollViewer to the DockPanel (it will be below the top buttons StackPanel)
|
|
||||||
[Windows.Controls.DockPanel]::SetDock($scrollViewer, [Windows.Controls.Dock]::Bottom)
|
|
||||||
$dockPanelContainer.Children.Add($scrollViewer) | Out-Null
|
|
||||||
$panelcount++
|
$panelcount++
|
||||||
|
|
||||||
# Now proceed with adding category labels and entries to $itemsControl
|
# Now proceed with adding category labels and entries to $itemsControl
|
||||||
|
Loading…
Reference in New Issue
Block a user