Dynamically adding columns to a DataGrid

Viewed 17

I've been trying to find a solution to this but I couldn't find what I was looking for so ultimately I think I need to change my project type but figured I'd ask in case someone can save me time / educate me.

I have a console project that is using a created Window Form to allow some front end user interaction, but because of this I can only use a DataGrid. (The project is evolving as I make it that's why I'm in this situation.)

I would like to make something like this using a class if possible. I made the example by doing the hardcoded XAML way
XAML
enter image description here
after its made using the C# below. (Red is not there I added that)
Table to Create

This is what I have so far.
C#
enter image description here
If anyone can help me out with this it would be very much appreciated!

1 Answers

I ended up figuring this out because of another post after searching for a while. I'll just post my final solution in case anyone was wondering or stumbles upon this post.
C#
enter image description here
XAML
enter image description here

Related