M
M
M3fist02015-12-15 08:13:41
.NET
M3fist0, 2015-12-15 08:13:41

How to change DataGrid column headers depending on the data?

Hello!
I use DataGrid in my project. The table consists of two columns that are bound to a SortedList. One column is tied to Key, the other to Value, respectively. Column names: byte and byte value.
There was a need to display in the same table either a SortedList or just one hex value, depending on what the methods of the Model class return.
That is, in the case of SortedList, the table displays byte and byte value. And in the case of returning just a hex value, displays this hex value and its decimal value. Therefore, the column headings should also change to hexadecimal and decimal.
How to implement it? It's probably possible to describe this using XAML...
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boodmoo, 2015-12-15
@Boodmoo

I didn’t fully understand what was needed, but it seems to me that you can get by with Data triggers or look towards other types of triggers

R
Roman, 2015-12-15
@yarosroman

Also use a binding or refer directly to the DataGrid.Columns collection, returns the definition of a column that has a Header property

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question