473,800 Members | 2,659 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 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

Feb 12 '08 #1
0 1782

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

Similar topics

0
2621
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
3556
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 the columns to be able to be re-ordered at run
0
1181
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 ListViewRow : Object {
0
1310
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
4283
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
4676
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 move focus to another control and then tries to set focus back to ListView
3
1277
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 into the parallel controls in VB?
4
7469
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 and only the new look of the ListViewItem after the trigger takes effect shows what Item is...
0
1874
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 ComboBox to the same XML provider as the ListView...
0
9691
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10507
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9092
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2948
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.