WPF ListView - how to add items programmatically?

后端 未结 1 1407
粉色の甜心
粉色の甜心 2020-12-10 00:47

Even if I know it\'s not ideal - I need to programmatically populate a listView (for whatever reason).

I am declaring my columns in the markup:

              


        
相关标签:
1条回答
  • 2020-12-10 01:22

    It works changing the code to:

            MyData data = getDataItem(index); //< -- whatever
            this.myListView.Items.Add(data);
    

    Now it looks obvious but ... go figure!

    0 讨论(0)
提交回复
热议问题