473,513 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 listViewItemsArray() 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(listViewItemsArray)

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(sName)
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

Feb 12 '08 #1
0 1770

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2604
by: Martin Streller | last post by:
Hello, The code below represents a simple ownerdrawn, Listview class in C#. Its purpose is to avoid the flicker of the MS ListView. So I can't fall back to their one. Does anybody know why I cannot change the size of the ListView's font (ListView.Font) from e.g.
0
3538
by: ER | last post by:
Hi Guys Started having a play with WPF and need some direction with a grid. I am trying to build a list of products in a grid view with combox boxes as column headers that allow filtering and sorting (similar to lists in excel). Pic attached: http://www.ozgrid.com/images/Pictures/Filterswitches&Dropdown.jpg As a bonus, I would like the...
0
1155
by: bj7lewis | last post by:
WPF doesn't have ListViewSubItemCollection equall just ListViewItem that takes a content object but is arranged & clipped to the last cell in the column of given row.... I have a C# .NET 1.1 that saves all app data in user XML file thur XmlTextReader & XmlTextWriter. I load the XML file in to custom classes objects... public class...
0
1297
by: Griff | last post by:
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:
6
4255
by: John | last post by:
Hi If I have a choice of WPF or Windows Form versions of a control which one should I purchase? Thanks Regards
0
4583
by: =?Utf-8?B?SWdvcg==?= | last post by:
Hi everyone! I have some strange behavior of ListView control in WPF. We are developing application in C#. I created ListView with some items and set SelectedIndex to some index in the middle of its list. Then I clicked mouse at any place on the ListView and then navigate with Up/Dows keyboard keys, everything works perfectly. But If I...
3
1266
by: Just_a_fan | last post by:
I have been through two books where they talk about the (almost) parallel control set for WPF and VB. They go through the small difference and talk about everything going on a form but what they don't say is... WHY WPF? What did we get by having a (almost) parallel design palette. If the features were so good, why not just fold them...
4
7444
by: Brandon | last post by:
HI all, I am working on a WPF listview that get items through the XMLDataProvider and making a listview with two actual columns and in both CellTemplete XAML in a grid bind more than one snippet of the XML data to the cell. Now this works fine no problem... When I try to setup a IsSelected trigger I lose the default listview selection UI...
0
1858
by: Brandon | last post by:
Hi there... I got a WPF project that I am trying to select a ComboBoxItem in a ComboBox based on a string from the selected ListView item in the project... This ComboBox is unbound now and the ListView is grouped(Group section headings are the strings that populate the ComboBox Items) and bound to a XML provider. Later I will bound the...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.