Skip to content

Commit 942e317

Browse files
emosaruEmoSaruclaude
authored
Fix missing backgrounds in RecentPinnedLocations and GroupBox (#23)
* Fix missing backgrounds in RecentPinnedLocations and GroupBox - RecentPinnedLocations template was missing a Background binding on its Grid, unlike all sibling container templates (ArrayPanel, Container, etc.). Added the same StringToBrushConverter binding. - GroupBox content-area background used FallbackValue=#66212121, which only fires on binding errors. When StringToBrushConverter returns null (empty string or null Background value), Avalonia sets the property to null (transparent). Changed to TargetNullValue so the default dark fill is applied whenever the converter produces null. Fixes #16 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix missing backgrounds in RecentPinnedLocations and GroupBox - RecentPinnedLocations Grid was missing a Background binding; added StringToBrushConverter binding matching all other container templates - GroupBox content area used FallbackValue for null Background; changed to TargetNullValue so the default #66212121 fill applies when the converter returns null (not just on binding errors) - ScrollPanel content now has MinHeight bound to the ScrollViewer's viewport height so DockPanel LastChildFill works correctly: Avalonia's ScrollViewer passes infinite height to content, collapsing the GroupBox to zero height when empty; the MinHeight constraint gives the DockPanel a finite lower bound while still allowing overflow scrolling Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix ScrollPanel content not filling viewport for DockPanel LastChildFill The previous fix (MinHeight only) was insufficient: the default StackPanel items panel gives each child only its desired height regardless of MinHeight, so the inner DockPanel never received the viewport height as a finite constraint and LastChildFill could not allocate remaining space to the Pinned Locations GroupBox. Fix: switch the ScrollPanel items panel from StackPanel to Grid. A Grid stretches its single content child to fill the full arranged height, so the DockPanel receives a finite height equal to the viewport and LastChildFill correctly allocates remaining space to the last child. MinHeight is retained to ensure the Grid's arranged height is at least the ScrollViewer's visible viewport height even when content is shorter, while content taller than the viewport still overflows and scrolls. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: EmoSaru <emosaru@emosaru.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5eecc9f commit 942e317

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

EmoTracker/UI/LayoutControl.axaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
</LayoutTransformControl.LayoutTransform>
5757
<Grid Width="{Binding Width, Converter={x:Static converters:NegativeToNaNDoubleConverter.Instance}}"
5858
Height="{Binding Height, Converter={x:Static converters:NegativeToNaNDoubleConverter.Instance}}"
59+
Background="{Binding Background, Converter={x:Static converters:StringToBrushConverter.Instance}}"
5960
IsHitTestVisible="{Binding HitTestVisible}"
6061
MinWidth="{Binding MinWidth, Converter={x:Static converters:NegativeToZeroDoubleConverter.Instance}}"
6162
MinHeight="{Binding MinHeight, Converter={x:Static converters:NegativeToZeroDoubleConverter.Instance}}"
@@ -372,7 +373,7 @@
372373
</Grid>
373374
<!-- Content area -->
374375
<Grid Grid.Row="1"
375-
Background="{Binding Background, Converter={x:Static converters:StringToBrushConverter.Instance}, FallbackValue=#66212121}">
376+
Background="{Binding Background, Converter={x:Static converters:StringToBrushConverter.Instance}, TargetNullValue=#66212121, FallbackValue=#66212121}">
376377
<ItemsControl ItemsSource="{Binding Items}" Margin="5"
377378
ItemContainerTheme="{StaticResource StretchItemContainer}">
378379
<ItemsControl.ItemsPanel>
@@ -409,7 +410,20 @@
409410
Effect="{Binding DropShadow, Converter={x:Static converters:BoolToDropShadowEffectConverter.Instance}}">
410411
<ScrollViewer HorizontalScrollBarVisibility="{Binding HorizontalScrollBarVisibility, Converter={x:Static converters:TrivialEnumConverter.Instance}}"
411412
VerticalScrollBarVisibility="{Binding VerticalScrollBarVisibility, Converter={x:Static converters:TrivialEnumConverter.Instance}}">
412-
<ItemsControl ItemsSource="{Binding Items}" />
413+
<!-- Use a Grid panel (not the default StackPanel) so the single content
414+
child is stretched to fill the ItemsControl's full arranged height.
415+
MinHeight ties that height to the ScrollViewer's visible viewport so
416+
DockPanel LastChildFill receives a finite height and allocates the
417+
remaining space to the last child (e.g. the Pinned Locations GroupBox).
418+
Content taller than the viewport still overflows and scrolls normally. -->
419+
<ItemsControl ItemsSource="{Binding Items}"
420+
MinHeight="{Binding $parent[ScrollViewer].Bounds.Height}">
421+
<ItemsControl.ItemsPanel>
422+
<ItemsPanelTemplate>
423+
<Grid />
424+
</ItemsPanelTemplate>
425+
</ItemsControl.ItemsPanel>
426+
</ItemsControl>
413427
</ScrollViewer>
414428
</Grid>
415429
</LayoutTransformControl>

0 commit comments

Comments
 (0)