Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GuOrg/Gu.Wpf.DataGrid2D
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 306250e279dcc401af334d29cba0cb53903daae6
Choose a base ref
..
head repository: GuOrg/Gu.Wpf.DataGrid2D
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f8682fe227d364d427d6e535c535810a75b43d6c
Choose a head ref
Showing with 18 additions and 17 deletions.
  1. +1 −1 Gu.Wpf.DataGrid2D/Internals/BindingHelper.cs
  2. +14 −13 README.md
  3. +3 −3 paket.lock
2 changes: 1 addition & 1 deletion Gu.Wpf.DataGrid2D/Internals/BindingHelper.cs
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ internal BindingExpression OneWayTo(object source, PropertyPath sourcePath)
}
catch
{

// nasty here yes.
}

return bx;
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
[![Gitter Chat Room](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/JohanLarsson/Gu.Wpf.DataGrid2D?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) [![NuGet](https://img.shields.io/nuget/v/Gu.Wpf.DataGrid2D.svg)](https://www.nuget.org/packages/Gu.Wpf.DataGrid2D/)
[![Build status](https://ci.appveyor.com/api/projects/status/a92oxrywc9nv7f21?svg=true)](https://ci.appveyor.com/project/JohanLarsson/gu-wpf-datagrid2d)

Attached properties for WPF DataGrid enabling binding to sources of different types.
Attached properties for WPF DataGrid enabling binding to sources of different types. For using `DataGrid2D` you need to add `xmlns:dataGrid2D="http://gu.se/DataGrid2D"` in XAML

## Contents

@@ -26,16 +26,17 @@ Attached properties for WPF DataGrid enabling binding to sources of different ty
For binding to sources of type T[,]

### Array2D
<DataGrid HeadersVisibility="None"
dataGrid2D:ItemsSource.Array2D="{Binding Data2D}" />

```xml
<DataGrid HeadersVisibility="None"
dataGrid2D:ItemsSource.Array2D="{Binding Data2D}" />
```
Renders:
![ItemsSource2D render](http://i.imgur.com/00325df.png)

### Explicit columns
Columns are referred to by `C<zero_based_index>`

```
```xml
<DataGrid AutoGenerateColumns="False"
dataGrid2D:ItemsSource.Array2DTransposed="{Binding Data2D}">
<DataGrid.Columns>
@@ -49,7 +50,7 @@ Renders:
![ItemsSource2D render](http://i.imgur.com/IHvEI0c.png)

### With headers:
```
```xml
<DataGrid dataGrid2D:ItemsSource.Array2D="{Binding Data2D}"
dataGrid2D:ItemsSource.ColumnHeadersSource="{Binding ColumnHeaders}"
dataGrid2D:ItemsSource.RowHeadersSource="{Binding RowHeaders}" />
@@ -58,7 +59,7 @@ Renders:
![With headers screenie](http://i.imgur.com/GtEOW5G.png)

### Array2DTransposed
```
```xml
<DataGrid dataGrid2D:ItemsSource.Array2DTransposed="{Binding Data2D}" />
```
Renders:
@@ -69,7 +70,7 @@ Lets you bind to datasources of type `IEnumerable<IEnumerable>>`.
Tracks collection changes.

### RowsSource
```
```xml
<DataGrid HeadersVisibility="None"
dataGrid2D:ItemsSource.RowsSource="{Binding ListOfListsOfInts}" />
```
@@ -78,7 +79,7 @@ Renders:
![ItemsSource2D render](http://i.imgur.com/00325df.png)

### ColumnsSource
```
```xml
<DataGrid HeadersVisibility="None"
dataGrid2D:ItemsSource.ColumnsSource="{Binding ListOfListsOfInts}" />
```
@@ -88,7 +89,7 @@ Renders:
### Different lengths
Limited support for different lengths. Columns with blanks are default readonly.

```
```xml
<DataGrid dataGrid2D:ItemsSource.RowsSource="{Binding DifferentLengths}" />
```

@@ -100,7 +101,7 @@ Lets you two-way bind the item of the currently selected cell or index (row, col
For this to work these conditions must be satisfied:
- `SelectionUnit="Cell"`
- Columns must be of type `DataGridBoundColumn`. Don't think there is a way to dig out the bound property of a `DataGridTemplateColumn`
```
```xml
<DataGrid SelectionUnit="Cell"
dataGrid2D:ItemsSource.RowsSource="{Binding RowVms}"
dataGrid2D:Selected.CellItem="{Binding SelectedItem}"
@@ -120,7 +121,7 @@ Renders:

### TransposedSource with explicit columns
The property name column is named `Name` and the following columns are named `C<zero_based_index>`
```
```xml
<DataGrid AutoGenerateColumns="False"
dataGrid2D:ItemsSource.TransposedSource="{Binding Persons}">
<DataGrid.Columns>
@@ -137,7 +138,7 @@ Renders:
## Rownumbers
Conveninence attached property if you want to display rownumbers.
Specify the number to start fom using `StartAt`
```
```xml
<DataGrid ItemsSource="{Binding Persons}" dataGrid2D:Index.StartAt="1">
<DataGrid.RowHeaderStyle>
<Style TargetType="{x:Type DataGridRowHeader}">
6 changes: 3 additions & 3 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ GROUP Analyzers
FRAMEWORK: >= NET45
NUGET
remote: http://www.nuget.org/api/v2
JetBrains.Annotations (10.1.5)
JetBrains.Annotations (10.4)
StyleCop.Analyzers (1.0)
WpfAnalyzers (0.2.4-dev)
WpfAnalyzers (0.2.7.9)

GROUP Test
FRAMEWORK: >= NET45
NUGET
remote: http://www.nuget.org/api/v2
Castle.Core (3.3.3)
NUnit (3.4.1)
NUnit (3.5)
TestStack.White (0.13.3)
Castle.Core (>= 3.3)