listview

Is there an easy way to associate an event with a ListViewItem?

I have a WinForms ListView, obviously containing ListViewItems. I'd like to be able to attach a click event to each item, instead of to the entire ListView (and then trying to figure out what item was clicked). The reason for this is that I need to perform a different action based on which item was selected. The ListViewItem class seems ...

WPF How to bind GridView column width in code?

I need to bind width property of the GridView column that is created dynamically in code. Since GridViewColumn object has no SetBinding method, how should I do this? Thanks in advance. ...

Determining which ListViewItem was clicked on in a ListView when executing a ContextMenu MenuItem

I'm trying to use the context menu in a listview to run some code that requires data from which item it originated from. I initially just did this: XAML: <ListView x:Name="lvResources" ScrollViewer.VerticalScrollBarVisibility="Visible"> <ListView.Resources> <ContextMenu x:Key="resourceContextMenu"> <MenuI...

Implementing a custom sort for WinForms ListView

I have a class called Picture and that has a name and size (int) property. I was going to sort them using size, but not the displayed file name which is the item name in the listview. I implemented IComparer<Picture> for the Picture type, and then when I write this: this.PicList.ListViewItemSorter = AllPictures[0]; or this.PicList....

ASP.Net : DataPager Control always a step behind with paging

Take the following example...a page with a ListView and a DataPager used for paging the data of the ListView: Code Behind: protected void Page_Load(object sender, EventArgs e) { MyList.DataSource = GetSomeList(); MyList.DataBind(); } Source: <asp:ListView ID="MyList" runat="server"> <% //LayoutTemplate and ItemTemplate r...

WPF listview header hover/pressed color

Hi I'm trying to style the header of a listview depending on hover/pressed/etc. events. So far I tried a few things such as a trigger like the following but this does not work on my machine (a Vista Ultimate x64) <Style x:Key="GridViewColumnHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}"> <Style.Triggers> <Trigger...

How to access Button programatically if the button is inside using C#

Hi Guys, I have few questions as I am usign XAML for the first time. How do I use the button (BrowseButton) to browse a folder in Harddrive ? In this case as the button is inside Can I use the way I have shown below? Actually first dockpanel will hold the image and some label and the other dockpanel will have tabcontrol in it. If I ...

WPF ListView Focus ListViewItem

I have a Model-View-ViewModel implemented for a searchable ListBox. My Xaml looks like this: (Please ignore the fact what I'm doing inside, it's just for test purposes) <ListView ItemsSource="{Binding Path=People}" > <ListView.ItemTemplate> <DataTemplate> <Border> <...

Binding to the Current Item (WPF)

I am attempting to bind a ListView control to a DataTable, but the WPF binding system seems to be complaining about the binding path I specify. As an example, a GridViewColumn is defined as follows: <GridViewColumn Header="ColumnTitle" DisplayMemberBinding="{Binding Path=/, Converter={StaticResource myConverter}}"/> As far as I under...

c# separate context menu for listview header

How do i assign a separate context menu to the column headers of a listview in c#? ...

WPF ListView Show selected item

hi, i want to show the selected item in a list view automatically(it isn't possible to show all items without scrolling). this.listView.SelectedIndex = 999; selects of course an item, but it doesn't show it. what can i use to show it automatically ? kind regards, jeff ...

WPF ListView - how do i set selected item background colour?

Hi, I currently have this, but it only work for the foreground colour. Any help would be apriciated :D <Style.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter Property="Foreground" Value="Red" /> <Setter Property="Background" Value="Green"/> </Trigger> </Style.Triggers> ...

Determine if .NET ListView control is editing

I'm using a windows forms ListView in a C# application and I capture the KeyDown event on it to allow deleting a row using the Delete key. The TreeView class has the TreeNode.IsEditing property if I ever needed it but I couldn't find one in the ListView class. If the user is editing the label of a ListViewItem, I want the Delete key to...

I don't have ListView in toolbox, intellisense, and doens't work in code

I am using ASP.NET v3.5 and Visual Studio 2008. For some reason ListView doesn't appear in my toolbox, it doesn't show up in intellisense when coding, and if I try to include one anyways I can't access it from code behind (will give error saying it isn't declared). What am I missing here.... where is my listview!? Update: I have v3.5 ...

Dynamically adding combobox in DataList / Listview

I have a web page where I have to let the user dynamically add /remove comboboxes. I have a page I did a year ago where I used a datalist control to hold all the controls. Is a listview control any better? or is there a better approach? ...

Is it possible to change properties on a sub item in a DataTemplate using triggers from the containing control?

I want to change the background colour of the rectangle in the IsMouseOver trigger, is this possible? <Window> <Window.Resources> <DataTemplate x:Key="StackListViewItemTemplate"> <Grid> <Rectangle RadiusX="5" RadiusY="5" > <Rectangle.Fill> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0...

WPF/C#: ListView with colapsable items?

Hello, Does anyone have an idea, how to create a collapsable ListView? e.g. I've a ListView with the Columns: Name, Age, County and the following entries: + Max | 20 | Switzerland + Joe | 25 | Germany + Bob | 30 | Italy When I click on the +, I want the ListView to collapse like this: - Max | 20 | Switzerland Lastname: Eastw...

ASP.net Listview EditTemplate Hide/Show Options by Checkbox

Hey guys, I'll get right to the point. I have a listview which has an ItemTemplate and EditTemplate. When I switch an item into edit mode I have a bunch of checkboxes as options. Now the problem. in Editmode I would like to have certain options disappear (or replaced by "--") when certain checkboxes are unchecked and of course reappea...

WPF listview remove extra column generated

Hi, When I use a ListView in WPF it always generates one extra column at the end of the ListView. For example, if I define two columns in my listview and when I run it it generates those two columns plus one empty column header. Any idea how I can remove that? Sample ListView XAML <ListView ItemsSource="{Binding Path=SearchAttributes}...

ASP.net ListView Access controls in ItemUpdating event

I'm missing something here... I need to access the values of the controls on the item that is leaving editmode, thus firing ItemUpdating. I found how to get the key value so I know which record in the database I have to update. The problem is that I can't seem to access the values of the controls on the editing row. the EditTemplate c...