Click here to Skip to main content
15,898,222 members
Everything / ListView

ListView

ListView

Great Reads

by ThatsAlok
Using Fragments in your mobile application.
by #realJSOP
A WPF ListView that automatically generates columns (that are also sortable) based on decorated entity properties
by John Atten
Examination of a quick way to create more useful expandable groups in the .NET ListView control.
by Technoses
The above code will slow down the browser and the browser can hang when Rows in Grid will be 10000 or above.Please view the below suggestion:CS Codeprotected void grvGroups_RowDataBound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { ...

Latest Articles

by Jovibor
List Control with tooltips, cells editing, colors, sorting, hyperlinks, columns hiding, and a lot more
by #realJSOP
A WPF ListView that automatically generates columns (that are also sortable) based on decorated entity properties
by Thiagarajan Rajendran
How to create a checkbox list using simple HTML and jQuery
by Michael Shpilt
A WPF tutorial on how to create FilteredListView: A ListView custom control with search filter that uses Throttling.

All Articles

Sort by Updated

ListView 

N 1 May 2024 by Member 16140179
When I was Using MS office 2003/7, at that time I faced This Error. Actually, This Is Excel Error Means There Is Bug In earlier Version of MS Office Excel. So To Solve This Error I Used MS office 2013 & Good New Is That My Problem Solved. So Use...
15 Apr 2024 by Graeme_Grant
If you are using data binding, like in this article here: Data binding a ListView[^], then the ListView control becomes a view of the data, not the data container itself. Then you only need to show the properties as columns, as required. This...
15 Apr 2024 by Ismael_1999
I need to create a list view with 3 columns, but I need also 2 more columns with related data that should not be viewed. Is there a way to do this? Thank you. I use Microsoft Visual Studio 2022 and this application is in Windows Forms. What I...
14 Apr 2024 by Pete O'Hanlon
As an alternative to Ravi's answer, there is a quick and dirty "hack" that you can use, assuming you are using Windows Forms here. When you add an item into a listview, you are adding an instance of a ListViewItem. This class has a Tag property...
14 Apr 2024 by Ravi Bhavnani
There's no standard way to do this in Windows Forms. The alternative I use is to manage a ListView's configuration in another object and initialize and populate the ListView appropriately.� See this screenshot as an example:...
19 Mar 2024 by Graeme_Grant
I am not sure what you are trying to do however I'll show you how to handle each item in the ObservableCollection. The Item class needs to implement the INotifyPropertyChanged Interface (System.ComponentModel)[^]. Microsoft provide a sample: How...
17 Mar 2024 by Pete O'Hanlon
You cannot tell if an object has been changed using an ObservableCollection. The way to do this is to use INotifyPropertyChanged and raise the PropertyChanged event whenever you change the value in a property.
17 Mar 2024 by Sh.H.
Hi folks. I have an Observation Collection. I used event CollectionChanged. But this event only raises when new item added, or an item deleted. So how can I detect if an item edited? (And ofcourse, it would better also to detect which item got...
23 Dec 2023 by M Imran Ansari
The issue may caused by third-party Excel COM plug-in, refer to the provided link, and it is anticipated that your issue will be resolved. https://superuser.com/questions/1124945/excel-interop-remote-procedure-call-failed-or-rpc-e-serverfault[^]
23 Dec 2023 by OriginalGriff
To be honest, we can't help you with that little info, and probably can't give you a "full solution" at all - simply because we have no way to access your spreadsheet on your system while you code is running, and you need that to begin diagnosing...
23 Dec 2023 by Jayanta Modak
The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) when run my project get this error please help me solve the problem What I have tried: Private Function GetXlUsedRange(ByVal filePath As String) As...
6 Dec 2023 by Maciej Los
I'd suggest to use gridview control rather than a listview. See: How to Merge Cells with Equal Values in a GridView[^] Rows and Columns Merging in ASP.NET GridView Control[^]
5 Dec 2023 by Richard Deeming
Quote: Unable to cast object of type 'System.Web.UI.WebControls.Label' to type 'System.Web.UI.WebControls.TableCell'. Well there are two places where that error could occur, and they both refer to the same control: ...
5 Dec 2023 by Anuragintit
I need to merge the common row in listview, but long time search i am unable to find out the solution, any one can please help. Getting the Error: Unable to cast object of type 'System.Web.UI.WebControls.Label' to type...
15 Sep 2023 by David Edwards 2022
I know there are 1000+ examples of doing this, but I cannot seem to make it work. What I have tried: This is my sample. The first part is just a bit of code proving that there is an image in the first position. This is a sample of what I have...
14 Sep 2023 by OriginalGriff
Set the ImageSize BEFORE you add the items: otherwise, it discards all images that aren't exactly right. imageList1.ImageSize = new Size(32, 32); ImageList1.Images.Add("pic1", Image.FromFile("c:\\egg\\test\\014.jpg")); pictureBox1.Image =...
14 Sep 2023 by Graeme_Grant
Google Search is your best friend. There are thousands of examples on how to do this: winform listview using imagelist examples C# - Google Search[^] YouTube is your other best friend: winform listview using imagelist - YouTube Search[^] Pick...
12 Sep 2023 by NoviceCoder871987
I ran into a weird issue with custom drawing the listview control. I drew the grid lines in response to CDDS_POSTPAINT notification. All working okay so far. However, when scrolling vertically, the lines will be messed up and will not be drawn at...
9 Sep 2023 by Richard MacCutchan
See About Custom Draw - Win32 apps | Microsoft Learn[^] for custom drawing in Report mode.
9 Jul 2023 by Avtem
There is a WM_SETREDRAW message in WinAPI which you can send to a window in order to suspend/resume drawing updates. It works fine, but as soon as i add visual styles from comctl32 v.6.0.0 to my program calling WM_SETREDRAW on a ListView control...
9 Jul 2023 by Avtem
Unfortunately i couldn't figure out how to use WM_SETREDRAW with ListView controls, but since MDSN describes us how it's implemented i decided to do what they do - remove or add WS_VISIBLE style from the window without invalidating its rectangle....
9 Jul 2023 by Richard MacCutchan
See the Remarks section at WM_SETREDRAW message[^].
22 Jun 2023 by Joey Arnanzo
Hello all,I've created a restaurant POS and i'm having trouble with the listview printingthe target is to print in the receipt the followingProduct Quantity Unit Price TotalI've managed through coding to print it, but I have another problemusing the following...
22 Jun 2023 by Pranav Shrivastava
where offset is declare in program please help me to solve it e.Graphics.DrawString(lvProductItems.Items[i].SubItems[0].Text + " " +...
14 Jun 2023 by suhail malik 2023
hey, trying to put dynamic button in list view which should go to relevant form or page on click event. right now can click on button but how will i make it to go to relevant form What I have tried: ...
14 Jun 2023 by Graeme_Grant
It's called navigation between pages. Here is a search with many solutions and information: c# maui navigation - Google Search[^] Here is a video on the subject by the Xamaria/Maui guru: Navigating Between Pages in .NET MAUI [6 of 8] | .NET...
10 May 2023 by Jovibor
List Control with tooltips, cells editing, colors, sorting, hyperlinks, columns hiding, and a lot more
7 Mar 2023 by Graeme_Grant
The documentation is quite clear, it lists the events that are supported: ListCollectionView Class (System.Windows.Data) | Microsoft Learn[^]. In your case, you want to listen to the CollectionChanged[^] event. UPDATE Here is how to handle the...
6 Mar 2023 by Chris Copeland
I would say it depends on what type of collection the devices variable is. If it's just a List then changes won't be reflected in the UI because a List doesn't emit an event when it's content changes. You probably have two options: 1)...
6 Mar 2023 by Member 15061773
Hi there, I have a WPF application where I use ListCollectionView as ItemsSource of a ComboBox. This ListCollectionView mainly populate from an AudioDevice class. Actually, previously I make a List based on the AudioDevice class. My...
3 Feb 2023 by Member 15758581
I want to add a filtering-function to my (WPF) program. My problem isn that i don't know how i could find specific Items/Objects (DataGridTextColumns) from the DataGrid. I want to search for specific properties like as an example if my object...
3 Feb 2023 by OriginalGriff
Start here: How to: Group, sort, and filter Data in the DataGrid control - WPF .NET Framework | Microsoft Learn[^]
8 Jan 2023 by Richard MacCutchan
The course number and grade, as shown in the question, are strings, not integers. So your code should be: course_no = input("enter course number: ") number_of_credits = int(input("enter number of credits: ")) grade_received = input("enter grade...
7 Jan 2023 by CPallini
The input data types are: course - string credits - integer grade_- string You are required to validate inputs: course must be a string starting with capital letters and ending with digits. You may either check it iterating over its character...
7 Jan 2023 by Parth 2023
Write a program that will repeatedly take (for a student) input of this type: course_no, number_of_credits, and grade_received (eg. CSE101 4 A). These inputs are for the courses the student has done in the semester. If no input is given (i.e....
2 Dec 2022 by Rishi 2022
I am doing sample based on the numbers extracted after the filteration operation.Below is the count i am getting:- df_ID[['Bucket','Service']].value_counts() Output:- Eg. Bucket Service Tier 2 das ...
14 Oct 2022 by wehrbar
Thank you both, but I have found the solution to my issue. However, to give some background to the context, the Federal Government releases a PDF document (and it is ONLY available as a PDF document) of a list of about 20k financial products....
14 Oct 2022 by wehrbar
I have an UI with a list view control on it that loads several thousand lines of data across about 50 columns. This is easy to export to Excel directly from the UI since the ListView lives on the UI thread, but I would like to create a separate...
13 Oct 2022 by OriginalGriff
To add to what Dave has - rightly - said: you should never throw "thousands of lines" at a user anyway: it's slow, inefficient, and for the user completely useless - how long do you think it's going to take a user to find the row he is interested...
13 Oct 2022 by Dave Kreskowiak
You don't. You cannot touch a control from any other thread other than the UI (startup) thread. You're using the ListView control as a container for data instead of its intended purpose of displaying and editing data. You should be holding all...
3 Oct 2022 by dell-gl62m
I set my ListView properties like thisListView1.View = View.ListListView1.FullRowSelect = TrueListView1.GridLines = TrueBut still when I select any item in ListView, the full row is not highlighted. It only highlight the icon with it's text. Is there any way I can highlight the whole row...
3 Oct 2022 by Member 8006524
I use this in DoDataExchange m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
14 Aug 2022 by Member 10618364
I want to change table rows in my database, instead manual table. This is my code: public interface IMainMenuService { List GetAllMenu(); } public class MainMenuService : IMainMenuService { public...
14 Aug 2022 by Graeme_Grant
Based on the limited information available, and the lack of DB code, I understand the question as "How do I work with SQL Server to maintain my data?" There are fantastic tutorial websites that will answer these questions and more better than we...
14 Aug 2022 by Member 10618364
ok I Want Load Main Menu of MySite Dynamically With SqlServer DataBase. my project is "asp.net core razor page" I using ComponentView for MainMenu. I use Service to load mainmenu this is IMainMenuService Code: namespace...
18 May 2022 by Member 15067932
Hello Codeproject comunity. I came to ask ur help becouse i still cant figure it out what is happening. Im working with WPF XAML Net Framework 4.8 i have a listview that get information of an API so when i select one of the items its should...
18 May 2022 by Graeme_Grant
There is too much code here to help you. Also, your comment "but after i redirect and go back the controls of filter datepicker didnt work" does not tell us what is happening. HOW does it not work? Do you get an error message? Does the listview...
14 May 2022 by Code4Ever
I'm using MVVM architecture in my test project. I have a ListView. The data is bonded to the SQLite database. I want to delete all selected items from the database. The delete button should be activated if at least an item is selected. I cannot...
14 May 2022 by Code4Ever
The following StackOverFlow link solved my problem: c# - Binding SelectedItems of ListView to ViewModel - Stack Overflow[^]
1 May 2022 by gunturrohith
Hi, I have a Qml list view with Left, Right Scrolling Buttons and that can display 7 items at a time. The ListView orientation is Horizontal. What I expect to achieve is: assume there are in total 12 items in the list 1)If User has not selected...
11 Feb 2022 by Casper Josiah
I am trying to the contents of my List to a listView. My list is a list of objects and is in a separate form from my ListView. Here's is a snippet of my code public partial class Form1 : Form { String path =...
11 Feb 2022 by OriginalGriff
Exactly how depends on the "relationship" between the two forms. Have a look at these, one of them will fit your circumstances. The form that creates an instance of another: MyForm mf = new MyForm(); mf.Show(); Is the "parent", the other form is...
27 Jan 2022 by materialAres
I have to do this project of classified ads for Coursera. Essentially every user can post, update and delete advertisements. The problem is that even if the objects are correctly stored (I checked tables and objects via admin and manually with...
23 Dec 2021 by Mars JPN
Hi Peeps, Good Day! I am a student studying Information Technology. I have a total of 3 listviews. ListView1 has 1 column. ListView2 has 1 column. ListVIew3 has 2 columns ( ListView1Column and ListView2Column combination). How can I...
23 Dec 2021 by Richard MacCutchan
I already gave you the answer at How to copy/clone in listview[^]. Please do not repost the same questions.
22 Dec 2021 by CHill60
If you get the DataSources of the ListView1 and ListView2 as DataTables then you can use this method to create a third datatable with the columns from each of the other two - Combining DataTables with Different Schema[^] This might help with...
20 Dec 2021 by Mars JPN
Hi Peeps, Good Day! I have a total of 3 listviews. ListView1 has 1 column. ListView2 has 1 column. ListVIew3 has 2 columns ( ListView1Column and ListView2Column combination). How can I copy/clone the inputted data from ListView1 and/or...
20 Dec 2021 by #realJSOP
0) Instead of having a ListView that has one column, wouldn't it make a lot more sense to use a ComboBox? 1) If you use binding, you don't have to manipulate the control itself when items are added.
4 Dec 2021 by Zeeshan Dar 2021
DataSet values to store in List object I have a DataSet, that needs to be passed into a list object. Name of columns in DataSet are same as properties of list object. Example: Data Set columns PickupCity PickupState PickupCountry List...
4 Dec 2021 by Zeeshan Dar 2021
Hi, After searching and few adjustments, below solution worked for me. Create helper class public static class Helper { public static List DataTableToList(this DataTable table) where T : class, new() { ...
4 Dec 2021 by OriginalGriff
Try this: Conversion Between DataTable and List in C#[^]
30 Oct 2021 by Avtem
What i need Does LVS_EX_LABELTIP for Win32 ListView automatically implement showing tooltips for truncated items (i.g."Hello, W...")? Like style LVS_EX_CHECKBOXES which works "out of the box". Or is it developers responsibility? (From reading...
26 Oct 2021 by KarstenK
the label tip has some standard amount of characters, so a lengthly text gets truncated. Your flag is to override that default behaviour. "If a partially hidden label in any list view mode lacks tooltip text, the list-view control will unfold...
14 Oct 2021 by rakeshkumar_pune
I have defined a listview and 2 buttons as follows.
2 Oct 2021 by ah2005
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Dim Msg As CWPSTRUCT Select Case uMsg Case WM_NOTIFY Dim y As NMLVDISPINFO Dim item As LVITEM ...
14 Sep 2021 by Nico Nico Ni
import java.util.LinkedList; import java.util.Scanner; class Node { int data; Node next; Node(int data, Node next) { this.data = data; this.next = next; } } public class Main { // Helper function to...
20 May 2021 by JR212
Hi I'm trying to make my own header draw. So far it's working but I can't find the internal ID from the header. What I have tried: Dim pnmhdr = CType(m.GetLParam(GetType(NMHDR)), NMHDR) If pnmhdr.code = NM_CUSTOMDRAW Then ...
4 May 2021 by nalish Rathi
I have created a spinner having categories, and now I want to add the doctor's name in the subcategories, but I am not able to do it. What I have tried: String[] categories =...
18 Feb 2021 by #realJSOP
A WPF ListView that automatically generates columns (that are also sortable) based on decorated entity properties
3 Jan 2021 by Igor-84
I am creating ownerdraw component based on TCustomListView. All graphic work I do in the CustomDrawItem method.I have problems with checkbox. To draw it I use this code: if(Item->Checked){ iStateId = CBS_CHECKEDNORMAL; } else{ iStateId = CBS_UNCHECKEDNORMAL; } ...
3 Jan 2021 by hsialinboy
Try updating the ListView after DrawThemeBackground()...IE ListView1->Update(); or maybe even ListView1->Invalidate();
7 Dec 2020 by Member 14916292
wrote valueconverter. it works, but when I update my viewLists, the converter doesn't work. what is the problem? And can I solve it? thanks. What I have tried: I have a listview:
7 Dec 2020 by Member 14916292
I successed solving it!!! I needed to refresh the viewlist so after i updated the listview item,I added the next two lines: studentWithValueConvector.ItemsSource = null; studentWithValueConvector.ItemsSource = students; that made...
25 Nov 2020 by Komang Putra
I need help to fix this problem, i had a listview which datas keep change when i scrolling listview, here is my code public class ListViewAdapterTeam extends ArrayAdapter { public List team; ...
20 Nov 2020 by Komang Putra
I have a problem when i create a list view using 2 url, here is my code private void loadPlayer() { String jabatan = txt_jabatan_struktur.getText().toString().trim(); System.out.println("test 111 = " + jabatan); ...
19 Nov 2020 by EmDe-NJ
Quote: I'm trying to use a single Label to display one of the two data fields alternately in Xamarin Forms. Only Label 1 Displaying the binding field (Contact_Name), while second Label which I am trying to use a variable "DisplayField" is not...
19 Nov 2020 by Gerry Schmitz
When you create your "item source collection", assign either the VALUE of "email" OR "address" to the "display field" (column), and just display what's in that column. Easier than what you're trying to do.
8 Nov 2020 by Richard Deeming
Each time your code executes, you're adding items to movieItemList. But you never clear this list, and you never remove items from it. You'll just keep adding the results of the current query to the results of all previous queries. Try clearing...
8 Nov 2020 by Komang Putra
i need help to fix this bug, i wanna change the listview data if the string is change here is my code private void absensi() { sharedPreferences = getSharedPreferences("user_details", MODE_PRIVATE); String nik_baru =...
5 Nov 2020 by Patrice T
Quote: I am trying to show the small and largest number in a text box from the listview; however, it did not succeed after I spent 3 hours to google and try to fix it. First train yourself to find min a&nd max in a list of numbers by hand with a...
5 Nov 2020 by Member 14984719
Hi every one, I am a beginner for c#. I am trying to show the small and largest number in a text box from the listview; however, it did not succeed after I spent 3 hours to google and try to fix it. The simple view looks like this: ...
5 Nov 2020 by Gerry Schmitz
Why are you "summing"? Min / max doesn't use sums. For the first item, it is both the Min and the Max (assignment). After that, the "new" min is the next item if it is less than Min, else the new Max is the next item greater than Max. At the...
31 Oct 2020 by Gerry Schmitz
Create a "data class" containing your arrays. Serialize the data class (to XML or binary) and restore when you need it. I serialize (and compress, in some cases) the data class and add it as an embedded resource which I retrieve and deserialize...
31 Oct 2020 by EmDe-NJ
In my application I have multiple Array lists, (more than 20 in my case), trying to find a way to store them somewhere and call them back if possible, like in Modules in VB. Here is my code Models Class public class Contacts { ...
22 Oct 2020 by Patrice T
Quote: Index out of bound when remove item The error message also tell you where is the error. Good idea to tell us too. Advice: use the debugger, it will allow you to inspect the variables when error occurs. Your code do not behave the way...
21 Oct 2020 by Komang Putra
When i remove item automatic, my app is force close because of index out of bound so here is my code package com.example.eis2; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent;...
4 Oct 2020 by Gerry Schmitz
(My condolences: The Android documentation sucks.) If you can't figure out how to remove, try reloading (and syncing) the list view (without the "removed" item). I've found that reloading a (reasonable) list view doesn't necessarily mean the ui...
4 Oct 2020 by Komang Putra
I need help to fix this problem. i want remove item in list item in programmatically , here is my code... absensi_team.java package com.example.eis2; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import...
22 Sep 2020 by mskane64
I have a WPF DataGrid that uses a ListView with 3 columns. The second column can have 1 or more items associated with the first column item. I am able to capture the item index of the first column but when clicking in one of the associated...
15 Sep 2020 by abdou_31
Thanks to all, I have changed to listView with GridView and it work for now
15 Sep 2020 by abdou_31
I'm trying to bind data inside a listview that contains textblock , the problem is that I can only show the first element of the model ( the first row of the listview ) , I would like to bind all data in the listview. What I have tried: ...
14 Sep 2020 by Sandeep Mewara
Not sure how much you know about MVVM. Read/Learn about it: Model-View-ViewModel (MVVM) Explained[^] MVVM for Beginners[^] With MVVM, you would tie your listview with a data model that is of collection type. That collection would have some...
14 Sep 2020 by Chris Copeland
Are you saying that person.Status is an IObservableCollection and your ListView is only showing one row? If so, it's probably because you're not leveraging the ItemTemplate property correctly, which is used to indicate how each item is...
14 Sep 2020 by Arindam Mukherjee
For a couple of days, I am trying to achieve a simple task. I want to filter a listview and when I click on the filtered list item, the OnItemClickListener collect the postID from the desired list item and put that value to next activity. But the problem is, the onItemClickListener is not able...
9 Jul 2020 by amitb2
I have small app should pass values from 1 activity to custom listview that display in tab. The problem is I have 4 tabs and the values should appears in the 2nd tab but it doesn't, only after I pressed the last tab (4th) and go back to the 2nd...
28 Jun 2020 by Member 14859151
I have testdata model, and I want to map the column values to existing class hierarchy property's and currently it is not mapping the values and shows NULL value For instance in test data model i have field paymentOptions and in excel sheet the...
28 Jun 2020 by Member 14859151
Property Map Helper Function using System; using System.Collections.Generic; using System.Data; using System.Globalization; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace...
8 Jun 2020 by James Dean
I have this code that will check the listview checkbox if the condition is met. con = new SqlConnect(); con.SqlQuery("Select * from EmployeeDeduct where EmployeeeID = @empID"); con.cmd.Parameters.AddWithValue("@empID",...
11 Mar 2020 by chimmansrikanth
For Example Student { Name List } Subject { GroupName SubjectName Grade } DataGrid/ListView be like Subject Student1 Student2 Student3 ..... Student n...
11 Mar 2020 by Richard MacCutchan
Data binding overview - WPF | Microsoft Docs[^]