Click here to Skip to main content
15,664,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim x_col As New DataGridTextColumn
x_col.Header = some name
x_col.Binding = New Binding(some name)

Dim x_row As New DataGridRow
x_row.Item = New data_grid_add_item With {.dynamic_name = value}

Public Class data_grid_add_item 
        Public Property dynamic_name As String
End Class

What I have tried:

I see solutions in C, but not in VB for WPF. The class call is the problem. Trying to make it dynamic.
Richard MacCutchan 10-Feb-21 12:18pm    
WPF does not use C, it uses C# and VB.NET. And the two are close enough that an example in C# can easily be converted to VB.NET.
Member 11519580 10-Feb-21 12:47pm    
Thank you for the reply. I agree with the C#, but it seems hard to implement in Do you have any suggestions to try?
Richard MacCutchan 10-Feb-21 12:55pm    
What exactly is the problem?
Member 11519580 10-Feb-21 13:06pm    
I can create the columns dynamically, but how do I add the rows dynamically when the column binding changes. The problem for me. Is passing the column binding name to the public class.
Maciej Los 14-Feb-21 13:39pm    
The way you are trying to achieve your goal is wrong. You should use DataBindings instead. WPF is not the same as WinForm. See: WPF vs. WinForms - The complete WPF tutorial[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900