WPF: ListView help required

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Griff

    WPF: ListView help required

    I have a Windows appliction that I want to turn into a WPF application (as a
    proof of concept).

    However, I have encountered a problem with the ListView object and I can't
    find any suitable help files...

    There are two problems...

    Problem 1:

    The following *code* demonstrates what is occuring in my Windows
    application.

    ' Create an array of ListViewItems
    Dim listViewItemsAr ray() as ListViewItem

    ' Populate this array - I won't go into the code here, but I end up with an
    array of list view items....

    ' Add the array of list view items to the listView
    myForm.lvPeople .Items.AddRange (listViewItemsA rray)

    In the WPF application, the ListView object doesn't have the .AddRange
    method.

    Problem 2:

    I want to create a list view that has two columns, one with "firstname" and
    the second with "surname".

    In the Windows application, I have the following code (snippets)
    Dim lvItem as new ListViewItem
    With lvItem
    .Text = fName
    .SubItem.Add(sN ame)
    End With

    I then add this ListViewItem to my array and add it to the ListView as
    previously described.

    However, in the WPF application, the ListViewItem doesn't have a "Text"
    property anymore, it has "Content". I therefore set "Content" to be the
    fName. There doesn't seem to be any where to add the SubItems, so at a bit
    of a dead-end here.

    Any help on either/both these problems would be most appreciated.

    Many thanks

    Griff





Working...