I do not know the exact table how to bind to listview?

mc 3,481 Reputation points
2023-08-03T01:20:36.2366667+00:00

table 1

Id Name
Cell 1 Cell 2
Cell 3 Cell 4

table :

Id Name Val1 Val3 Val5
Cell 1 Cell 2 value value value
Cell 3 Cell 4 value value value

table:

you may know what I am saying that the column will change according the data.

how to bind it to listview?

maybe there is 3 or 5 or 7 or 1 or 10 cols in the listview

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
698 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 8,411 Reputation points Microsoft Vendor
    2023-08-03T02:52:55.0266667+00:00

    Hello,

    Welcome to Microsoft Q&A!

    I suggest you could try to use DataGrid to realize it. The DataGrid control provides a flexible way to display a collection of data in rows and columns. You could try to use the DataGrid.ItemsSource property to bind to a collection. And then you could set DataGridView.AutoGenerateColumns Property to true, then the columns will be created automatically.

    For more details, you could refer to the Doc: Binding a DataGrid to a data source.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.