Skip to content

Implement "AdaptiveColumnsPanel"#8

Merged
barjonp merged 3 commits intomasterfrom
GA/implement-adaptivecolumnspanel
May 12, 2025
Merged

Implement "AdaptiveColumnsPanel"#8
barjonp merged 3 commits intomasterfrom
GA/implement-adaptivecolumnspanel

Conversation

@giovanni-a
Copy link
Copy Markdown
Contributor

A responsive that dynamically switches between layouts based on its width:

  • when its width meets or exceeds NoColumnsBelowWidth, children are arranged into equal-width columns (one per visible child);
  • otherwise, they are stacked vertically in a single column.

Child horizontal and vertical alignments are respected within each allocated slot.

AdaptiveColumnsPanel_Screenshot1

Example of usage:

<Page
    x:Class="FastControls.TestApp.Pages.TestAdaptiveColumnsPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controlskit="clr-namespace:OpenSilver.ControlsKit;assembly=OpenSilver.ControlsKit.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d:DesignWidth="512" d:DesignHeight="932" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <controlskit:AdaptiveColumnsPanel NoColumnsBelowWidth="400" VerticalAlignment="Top">
        <Border Height="100" CornerRadius="20" Margin="5" Background="#CC505E00">
            <TextBlock Text="Content 1" HorizontalAlignment="Center" Foreground="White" Margin="0,10,0,0"/>
        </Border>
        <Border Height="100" CornerRadius="20" Margin="5" Background="#CC7D0030">
            <TextBlock Text="Content 2" HorizontalAlignment="Center" Foreground="White" Margin="0,10,0,0"/>
        </Border>
        <Border Height="100" CornerRadius="20" Margin="5" Background="#CC00567A">
            <TextBlock Text="Content 3" HorizontalAlignment="Center" Foreground="White" Margin="0,10,0,0"/>
        </Border>
    </controlskit:AdaptiveColumnsPanel>
</Page>

Comment thread src/OpenSilver.ControlsKit.Controls/AdaptiveColumnsPanel.cs
Comment thread src/OpenSilver.ControlsKit.Controls/AdaptiveColumnsPanel.cs
giovanni-a and others added 2 commits May 12, 2025 17:09
Co-authored-by: barjonp <barjon.pierre@gmail.com>
…ren (continuation)

Co-authored-by: barjonp <barjon.pierre@gmail.com>
@barjonp barjonp merged commit d2e29b6 into master May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants