Jerro.AutoGrid 1.0.0

dotnet add package Jerro.AutoGrid --version 1.0.0
NuGet\Install-Package Jerro.AutoGrid -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jerro.AutoGrid" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jerro.AutoGrid --version 1.0.0
#r "nuget: Jerro.AutoGrid, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Jerro.AutoGrid as a Cake Addin
#addin nuget:?package=Jerro.AutoGrid&version=1.0.0

// Install Jerro.AutoGrid as a Cake Tool
#tool nuget:?package=Jerro.AutoGrid&version=1.0.0

WpfToolkit

A magical replacement for the built in WPF Grid and StackPanel.

NOTE: I'm in the process of renaming this project from AutoGrid to WpfToolkit. This is because I plan to add more useful features to this package beyond just AutoGrid.

Installation

To add WpfToolkit to your WPF project, all you have to do is install it from NuGet:

Install-Package AutoGrid

Usage Examples

AutoGrid

In order to get

Form Image<br/> Sourced from the awesome WpfTutorials

You would typically write XAML that looked like

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="28" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="200" />
    </Grid.ColumnDefinitions>
    <Label Grid.Row="0" Grid.Column="0" Content="Name:"/>
    <Label Grid.Row="1" Grid.Column="0" Content="E-Mail:"/>
    <Label Grid.Row="2" Grid.Column="0" Content="Comment:"/>
    <TextBox Grid.Column="1" Grid.Row="0" Margin="3" />
    <TextBox Grid.Column="1" Grid.Row="1" Margin="3" />
    <TextBox Grid.Column="1" Grid.Row="2" Margin="3" />
    <Button Grid.Column="1" Grid.Row="3" HorizontalAlignment="Right" 
            MinWidth="80" Margin="3" Content="Send"  />
</Grid>

You can simply write

<st:AutoGrid Rows="Auto,Auto,*,28" Columns="Auto,200" Orientation="Vertical">
    <Label Content="Name:"/>
    <Label Content="E-Mail:"/>
    <Label Content="Comment:"/>
    <Label /> 
    
    <TextBox Margin="3" />
    <TextBox Margin="3" />
    <TextBox Margin="3" />
    <Button HorizontalAlignment="Right" 
            MinWidth="80" Margin="3" Content="Send"  />
</st:AutoGrid>

I personally like to put my Labels with the element they are labeling. So just remove the Orientation which defaults to Horizontal and rearrange the elements. You can also pull the common margin up, defining it only once.

<st:AutoGrid Rows="Auto,Auto,*,28" Columns="Auto,200" ChildMargin="3">
    <Label Content="Name:"/>
    <TextBox/>

    <Label Content="E-Mail:"/>
    <TextBox/>

    <Label Content="Comment:"/>
    <TextBox/>

    <Label />
    <Button HorizontalAlignment="Right" 
            MinWidth="80" Content="Send"  />
</st:AutoGrid>

StackPanel

The built in StackPanel control has always been frustrating to use. When you have a TextBlock that has a lot of text, it is impossible to wrap that text without setting an explicit width. Also, a StackPanel does not fill its container.

Also, I've always wanted a simple container which would apply a margin but only between child elements. This allows me to control the margin of the parent and the spacing between each child separately and cleanly.

<st:StackPanel Orientation="Horizontal" MarginBetweenChildren="10" Margin="10">
    <Button Content="Info" HorizontalAlignment="Left" st:StackPanel.Fill="Fill"/>
    <Button Content="Cancel"/>
    <Button Content="Save"/>
</st:StackPanel>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net5.0-windows7.0 is compatible.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 is compatible.  netcoreapp3.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.0

    • No dependencies.
  • .NETFramework 4.6.1

    • No dependencies.
  • net5.0-windows7.0

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 3,674 9/30/2022