Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/guorg/gu.wpf.autogrid


https://github.com/guorg/gu.wpf.autogrid

Last synced: about 4 hours ago
JSON representation

Awesome Lists containing this project

README

        

# Gu.Wpf.AutoGrid

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Build status](https://ci.appveyor.com/api/projects/status/weieh2q82cc87ksr/branch/master?svg=true)](https://ci.appveyor.com/project/JohanLarsson/gu-wpf-autogrid/branch/master)
[![NuGet](https://img.shields.io/nuget/v/Gu.Wpf.AutoRowGrid.svg)](https://www.nuget.org/packages/Gu.Wpf.AutoRowGrid/)

Small prototype for a less noisy WPF grid. Perhaps useful when prototyping.

# Grid
Is a `MarkupExtension` that spits out a new vanilla WPF grid when `ProvideValue` is called.

## ColumnDefinitions
### Attribute style

```xaml

...

```
### Element style

The designer may show a false negative error: `The attachable property 'ColumnDefinitions' was not found in type 'Grid'.`
Not sure if #pragma can be used in xaml somehow.

```xaml





...

```

# Row
Is just a `List` that insers its contents on the next row in the grid. This avoids specifying `Grid.Row="n"`on multiple elements that are oin the same row and makes reordering trivial.
Note that `Row`only exists in xaml for grouping elements on the same row. The idea is that it will making rearranging & reasoning about the grid easier.
Using a row the need for renumbering Grid.Row when moving things goes away.

# AutoIncrementation

By default children of a `Row` get column index from their position:
```xaml


```

If you want to set expllicit columns use UseExplicitColumns
```xaml



```

Can also be set on a single `UIElement`:

```xaml



```

Setting this on an element excludes it from the count so following elements are not affected.

## Defaults
The default for `AutoGrid` is `Increment` meaning children for `Row` get column index from position.
The default for `Row`and `Rows` is `Inherit` meaning they inherit incrementation from parent going all the way up to the `GridExtension`

## LastRowFill
If the last row should fill remaining space of if a starsized row should be added after the last row.

```xaml








```

## RowHeight

Set `RowHeight` to specify height of generated rows. If set to star `LastRowFill` will have no effect.

Or specify on individual rows like this:
```xaml







```

# Sample xaml:

```xaml













```

Produces:

![screenie](http://i.imgur.com/kAr50OX.png)

# Sample with nesting:
```xaml




























```

Produces:
![screenie](http://i.imgur.com/GQifcug.png)

# Limitation
As it is a markupextension using it like this will not work:

```xaml






...

```

![error](http://i.imgur.com/MkEn56s.png)

Not sure if there is a nice workaround for this. Think the lib still has potential to be useful.
A hacky way would be to set it as content for a lightweight element, probably good with a comment in xaml for stuff like this:

```xaml










´´´