listview

How to get a list of column headers of a listview based on displayindex?

If the AllowReorder column of a listview is set to true, how do I get a string list of the columnheader texts based on their displayindex at runtime? listview.Columns only returns columns in the original order. ...

Hierarchical data binding with nested ListViews in WPF

I have some data that has a detail table. I want the data to be presented in a ListView. I want the detail data to appear as a nested ListView when you select an item in the original list. I can't seem to figure out how to get the data binding to work. Here's what I have so far, (the problem is the {Binding Path=FK_History_HistoryItems}...

WPF GridView with a dynamic definition

I want to use the GridView mode of a ListView to display a set of data that my program will be receiving from an external source. The data will consist of two arrays, one of column names and one of strings values to populate the control. I don't see how to create a suitable class that I can use as the Item in a ListView. The only way ...

How do I make WPF ListView items repeat horizontally, like a horizontal scrollbar?

I have a WPF ListView which repeats the data vertically, I cannot figure out how to make it repeat horizontally, like the slideshow view in Windows Explorer. My current ListView definition is; <ListView ItemsSource="{StaticResource MyDataList}" ItemTemplate="{StaticResource ListViewTemplate}"> </ListView> The DataTemplace is (although...

WPF: Binding a listviewitem's background colour to a hex String property of an object

Hey. I have an object that has a string property called BackgroundColor. This string is the hexidecimal representation of a color. I cannot change this object. I'm binding a collection of these objects to a listView. What I would like to do is bind the background of the listview's row to the BackgroundColor property of the object that i...

How can I get an ListView item from the (X,Y) position?

I am dropping something in a ListView in WPF. I need to know the item in the (X,Y) position I am dropping. How can I do this? ...

Databinding ListView including its columns

I have a list of objects where each contains an arbitary number of parameters (name,value pairs). Now I want to bind the list of objects to a listview. Each column should represent a parameter (the column header is the name of the parameter) and each row an object with the list of parameter values. How can achive that the columns includi...

listview item cut style in .NET?

Hi All, How do I achieve the equivalent of the LVIS_CUT style for a listview item? It looks like it's not exposed by the framework? Should I P/Invoke? Edit: LVIS_CUT is a Win32 style that affects the look of the item: It grays the item image. You can see it in action in Windows Explorer: Select a file and type Ctrl+X. TIA. ...

How do I turn off row selection in a C# ListView -- specifically the dotted outline!

I have a ListView control that is in FullRowSelect mode, MultiSelect off and using the "Details" View mode. When the user clicks on a row, it highlights the row in blue, which is fine, But when I programatically turn off the selection by setting the row's "Selected" field to false, the blue highlight does go away, but it leaves a dotted ...

How do I get the start index and number of visible items in a ListView?

I have a listview working in virtual mode, in the LargeIcons view. Retrieves are expensive, so I want to ask for the data for all the visible items. How do I get the start index and total number of the visible items? Update: I am aware of the CacheVirtualItems event. The third-party database we're using takes ~3s to retrieve a single...

How do I listen for scrolling in a ListView?

The ListView doesn't seem to support the Scroll event. I need to call a function whenever the list is scrolled; how would I go about that? ...

WPF ListView Inactive Selection Color

I'm creating a WPF application where several ListView selections are made in a row (similar to the iTunes browser). The problem is that the default inactive selection color is too light. (see below) How can I change this color so my inactive listview looks like this? (see below) Solution Override the default SystemColor with a Style...

WPF : How can I get the height of a listview row

I need to know how high (in pixels) a row in a listview control will be, and can't find any way of getting it. Any ideas? The row just contains text, nothing fancy ...

How to cast object from (object sender, ListViewItemEventArgs e)

I am using the ListView Control with the following datasource List<MyObject> On my listview control i have an OnItemDataBound My question is how do get the current value of MyObject. Ie myObj[5].FirstName protected void ItemsListViewDataBound(object sender, ListViewItemEventArgs e) { // I want to do some kind of a cast here } ...

Asp.NET ListView Data Control Dynamically Databind

I am trying to implement a ListView data control for displaying and editing lookup table/ application level variables. There are multiple entity classes which can be bound to the ListView, so the ItemTemplate needs to be dynamically bound to the selected entity object. For example i have: AddressType { AddressTypeId, AddressTypeDescri...

Hide a table column in a nested ListView

I have a ListView inside another ListView, and I'd like to hide a table column in the inner ListView whenever a particular parameter is passed. Given the setup below, how would I hide the ID column (both the header and the data) if the URL contains "...?id=no"? <asp:ListView ID="ProcedureListView" runat="server"> <LayoutTemplate> ...

Change items in the LayoutTemplate of a nested ListView

This is related to my earlier question, but I thought I'd simplify it and make a challenge out of it. Given the code below, can you change the value of "ChangeThisLabel" from the code behind? <asp:ListView ID="OuterListView" runat="server"> <LayoutTemplate> <asp:PlaceHolder ID="itemPlaceHolder" runat="server" /> </Layout...

WPF changing button background color when the window is disabled

I have a button with a transparent background on a wpf window. Problem is, when I open up another window with a .showdialog the form becomes disabled as does the button, causing the button to go white (and stick out like a sore thumb); the same happens to the listview and textbox controls. Labels and group boxes aren't impacted in this...

Why am I getting null object reference error when saving (OnItemUpdating event) the first edit item in a ListView?

I'm getting the error "Object reference not set to an instance of an object." when trying to reference a HiddenField (lvEditProjectSteps_hdnStepStatusId for future reference) from the EditItem during the OnItemUpdating event after the Update event fires in a ListView. This only occurs on the FIRST item in the ListView. I checked the so...

Simple jQuery task failing: hide child elements of <div> tag

There has to be a simple explanation for this. I have a parent <div> tag containing a number of child divs that need to be hidden depending on their class. Problem is, I can't even seem to get a handle to my parent div. What on earth is the problem here? I'm going out of my gourd. The jQuery code (snippet) looks like this: $(functi...