PC Review


Reply
Thread Tools Rate Thread

How Can I Update a WPF ListView?

 
 
EagleRed@HighFlyingBirds.com
Guest
Posts: n/a
 
      12th Dec 2008
I have an application with a WPF ListView that is bound to a
List<CustomObject>. I do some processing and the add a new CustomObject
instance to the List. How can I display the ListView with the newly added
item? I tried resetting the ItemSource and that did not work.

As always, any input will be helpful.

Thanks,
Eagle
 
Reply With Quote
 
 
 
 
EagleRed@HighFlyingBirds.com
Guest
Posts: n/a
 
      13th Dec 2008
Sometimes it is good to find an answer to your own question. A way to do
this is to set teh ItemSource to null and then reassign it. The follow
snippet shows and example with a WPF ListView, myListView with a
List<CustomObject>, customObjectList, set as the ItemSource.

customObjectList.Add(newCustomObject);
myListView.ItemSource = null;
myListView.ItemSource = customObjectList;

"(E-Mail Removed)" wrote:

> I have an application with a WPF ListView that is bound to a
> List<CustomObject>. I do some processing and the add a new CustomObject
> instance to the List. How can I display the ListView with the newly added
> item? I tried resetting the ItemSource and that did not work.
>
> As always, any input will be helpful.
>
> Thanks,
> Eagle

 
Reply With Quote
 
yannick007
Guest
Posts: n/a
 
      21st Feb 2009
try
myListView.Items.Refresh()

that works for me
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ListView. Update and Cancel. shapper Microsoft ASP .NET 0 31st Jan 2008 03:55 PM
Listview backcolor update Jared Microsoft Dot NET Framework Forms 0 28th Mar 2006 04:45 AM
ListView Refresh and Update =?Utf-8?B?QXNzZW1ibHkgZmlsZSBsb2NrZWQ=?= Microsoft Dot NET Compact Framework 1 9th Sep 2005 09:35 PM
update listview Brent Starkes Microsoft C# .NET 4 14th Jul 2005 03:48 PM
ListView: Update FocusedItem Marc Ambrosius Microsoft Dot NET Compact Framework 1 30th Apr 2004 03:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:14 AM.