Skip to content

Commit 6d35ce1

Browse files
authored
Improve Readme.md: describe AdaptiveColumnsPanel and StaggeredPanel (#9)
1 parent d2e29b6 commit 6d35ce1

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,64 @@
11
# OpenSilver.ControlsKit
22
The ControlsKit is a collection of additional libraries, controls, and helpers that developers can use directly in their OpenSilver projects, to complement the built-in controls.
3+
4+
## AdaptiveColumnsPanel
5+
6+
A responsive that dynamically switches between layouts based on its width:
7+
- when its width meets or exceeds <c>NoColumnsBelowWidth</c>, children are arranged into equal-width columns (one per visible child);
8+
- otherwise, they are stacked vertically in a single column.
9+
10+
Child horizontal and vertical alignments are respected within each allocated slot.
11+
12+
![Screenshot of the AdaptiveColumnsPanel](docs/images/AdaptiveColumnsPanel_Screenshot1.gif)
13+
14+
Example of usage:
15+
16+
```xml
17+
<Page
18+
x:Class="FastControls.TestApp.Pages.TestAdaptiveColumnsPanel"
19+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
20+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
21+
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">
22+
<controlskit:AdaptiveColumnsPanel NoColumnsBelowWidth="400" VerticalAlignment="Top">
23+
<Border Height="100" CornerRadius="20" Margin="5" Background="#CC505E00">
24+
<TextBlock Text="Content 1" HorizontalAlignment="Center" Foreground="White" Margin="0,10,0,0"/>
25+
</Border>
26+
<Border Height="100" CornerRadius="20" Margin="5" Background="#CC7D0030">
27+
<TextBlock Text="Content 2" HorizontalAlignment="Center" Foreground="White" Margin="0,10,0,0"/>
28+
</Border>
29+
<Border Height="100" CornerRadius="20" Margin="5" Background="#CC00567A">
30+
<TextBlock Text="Content 3" HorizontalAlignment="Center" Foreground="White" Margin="0,10,0,0"/>
31+
</Border>
32+
</controlskit:AdaptiveColumnsPanel>
33+
</Page>
34+
```
35+
36+
## StaggeredPanel
37+
38+
A panel that arranges children in a masonry-like layout:
39+
- It lays out children in columns of equal width but varying heights.
40+
- It tries to balance the total height of each column, minimizing visual gaps.
41+
- It's useful for dynamic content where each item may be a different size.
42+
43+
![Screenshot of the AdaptiveColumnsPanel](docs/images/StaggeredPanel_Screenshot1.png)
44+
45+
Example of usage:
46+
47+
```xml
48+
<Page
49+
x:Class="FastControls.TestApp.Pages.TestStaggeredPanel"
50+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
51+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
52+
xmlns:controlskit="clr-namespace:OpenSilver.ControlsKit;assembly=OpenSilver.ControlsKit.Controls"
53+
xmlns:local="clr-namespace:FastGrid.FastGrid"
54+
xmlns:fg="clr-namespace:FastGrid"
55+
xmlns:conv="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls">
56+
<controlskit:StaggeredPanel DesiredColumnWidth="100" RowSpacing="20" ColumnSpacing="20">
57+
<Border Width="100" Height="100" Background="Red"/>
58+
<Border Width="100" Height="300" Background="Blue"/>
59+
<Border Width="100" Height="200" Background="Green"/>
60+
<Border Width="500" Height="300" Background="Yellow"/>
61+
</controlskit:StaggeredPanel>
62+
</Page>
63+
64+
```
545 KB
Loading
2.68 KB
Loading

0 commit comments

Comments
 (0)