A
A
Andrey Shirshov2018-02-25 19:43:00
.NET
Andrey Shirshov, 2018-02-25 19:43:00

How to make in datagrid (WPF) data binding for columns and not rows?

Hello!
There is a Calc class. At the input -- parameters int a, int b, bool c. The output parameters are int d, double e, bool f.
Let the connection of input and output parameters be as follows:
d = a + b
e = (a*a) / (b*b)
f = !c
I made such a class, then created an ObservableCollection containing the results of 3 calculations.
I need to make the following table:
The first column is the names of the parameters: a, b, c, d, e, f.
The second column is calculation 1, the third column is calculation 2, and so on.
In each column (except the first one), the first 3 cells (for a, b ) must contain inputs for editing, line 3 (for c) is a checkbox, the rest are just text.

==================================
| Параметр | Расчёт 1 | Расчёт 2 |
==================================
| a        | [     1] | [     5] |
| b        | [     2] | [    10] |
| c        | [x]      | [ ]      |
| d        | 3        | 15       |
| e        | 0.25     | 0.25     |
| f        | false    | true     |
==================================

Not the first hour I fight, I can’t do this ... The problem is not only that the column has mixed content. When I create an ObservableCollection, each of its elements corresponds to a table row, and I need it to correspond to a table column.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2018-02-25
@Nipheris

You can try following these tips: https://archive.codeplex.com/?p=rotatedwpfdatagrid .
Well, or abandon the DataGrid and look towards other controls.

F
FreeBa, 2018-02-25
@FreeBa

You are trying to make friends with cutlets cockroaches. Input and output data are different entities, separate them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question