.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Nested ListView: Parent listview item auto selection on child ListViewitem select

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :WPF

how can i auto select paraten listview item on selecting child listview item?

ListView ItemContainerStyle="{StaticResource myStyle}" Name="lv_list" Margin="5" HorizontalContentAlignment="Stretch">

View Complete Post

More Related Resource Links

Display a nested child ListView on PostBack while using DataPager on parent ListView


Hello ASP.NET community,

I am having trouble finding how to solve the following issue :

I am using nested listviews to display Sales and Sales details.

The main ListView displays General Information about Sales and the child ListView displays the detailed information about one sale. the child listview is shown only when the user clicks on a link (see included code, DataBind is made on PageLoad) :

ASPX Markup Code :

<asp:listview id="lvSales" runat="server" onitemdatabound="lvSales_ItemDataBound">
<table cellspacing="0" border="1" width="250" style="border-collapse:collapse;">
<tr runat="server" id="headerRow">
<th scope="col" style="width:30px;"></th>
<th scope="col">SaleNumber</th>
<tr id="itemPlaceHolder" runat="server" enableviewstate="true"/>
<tr id="row" runat="server">
<td style="text-align:center;"><asp:button id="btnShowHideDetails" runat="server" oncommand=&qu

How to select some part of a text in listview item?


Dear all

I have a listview in WPF application, that I bind data in it using gridview. now I want to make a search for it. making search is simple but question is this I want to make a search that if user type 'a' then system will highlight all 'a' in list view. or if user type 'lis' the system will highlight all 'lis' in that listview.

Is it possible to highlight part of the text in side of listview item? or I have to select whole listviewitme? 


Thank you so much

select listview item


Hi All.

I would like to select added ListView item in case when ListView has checkbox column.


 <DataTemplate x:Key="CheckBoxCell">
  <StackPanel Orientation="Horizontal">
   <CheckBox Name="chk" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSou

Listview & GridView , select an item




i create a ListView with a GridView and some GridViewColumn´s in therein:

<ListView ItemsSource="{Binding Records}" x:Name="list" Margin="21,8,21,18.9" Grid.Row="2" Background="{StaticResource linearbrush2}" HorizontalContentAlignment="Center">
      <GridViewColumn  DisplayMemberBinding="{Binding hd_drive}" Width="35" Header=" Drive"/>
      <GridViewColumn  DisplayMemberBinding="{Binding browser_name}" Width="100" Header="Browsername"/>
      <GridViewColumn x:Name="defaultbrowserpath" DisplayMemberBinding="{Binding file_path}" Width="300" Header="Path" /> 

the DisplayMemberBinding-Property points to a ObservableCollection, with the Name Records,

How to keep the hover for Parent menu and set the selected menu item css for child menu item?



I'm using cssfriendly control adapter for menu. My asp.net menu control's datasource is a sitemap file I'm using which contains all the urls.

I have the following questions:

  1. Is there a way to keep the parent menu item hovered while hovering over the respective child menu items?
  2. Is there a way to keep the child menu item selected? I am able to set the css for the parent menu, however I was wondering if the same is possible with the child items.

Please help! Smile


Moneka Smile

listview 3.5 bind dropdownlists edit item template VB.NET


I am trying to do this with many issues of data binding doubling the amount and not setting selectedValue on dropdownlist. I have read some posts and they help but I am missing a crucial piece. My problem is that my dropdownlist is doubling the amount of records for the dropdownlist. Instead of "YES;NO;SELECT A VALUE", I am getting "YES;NO;SELECT A VALUE;YES;NO;YES;NO". My database is correct with the UPDATE part but the rebind after update is failing horribly.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            If Session("ACTIVETAB").ToString() = Session("SUBCONTRACTSATABNO").ToString() Then
            End If
        End If
    End Sub

    Public Function loadlookups(ByVal id As String, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) As DataTable
        Select Case id
            Case "ddlCertReceived"
                dt = GetLookupTable("SubcontractsA", "Sub 1 Cert Received")
                Dim ddlCertReceived As DropDownList = _
                CType(e.Item.FindControl("ddlCertReceived"), DropDownList)
                ddlCertReceived.DataSource = dt
                ddlCertReceived.DataTextField = "lup_text"

Nested listview fk-problem with insert



My problem is this, i have a nested listview that works fine but if i need to do an insert and the nested listview dont have retrived any values (that is no posts created) i cant get hold of the fk that i need. If i put a hiddenfield in the parents listview with the fk how can i find it in codebehind when i do an insert? 



Owner-drawn ListView and nonstandard subitem size: selection problems.

Hello, I have a ListView whose first column is owner-drawn and items can be selected (I had to jump through hoops to draw the focus rectangle correctly). The problem is, my custom drawing displays the text in a wider font than normal, and only for this column. And when I click an item to select it, the right part of the text does not react, because the listview doesn't "know" there is text there (since it "thinks" the text is smaller). How can I correct this? Is there a "hit test" or "measure item" event or something, to tell the list view to consider a wider zone for clicks?

A layout, mouse selection, ListView problem/question

I'm having a problem with a particular layout scenario, and how it interacts with a left mouse click in certain situations. I have 3 rows in a Grid.  The first is a ListView (Master), with the Row Height set to '*'. It's ItemSource is bound to a collection in a ViewModel, and its SelectedItem is bound to a value in the ViewModel.  When the SelectedItem is null, it should take up its entire container (the other 2 rows are invisible). The second row is the GridSplitter.  It's visibility is bound to a value in the ViewModel.  It's only visible when the SelectedItem in the Master ListView is not null.  It's GridRow height is set to Auto, and it's height is explicitly set to 5 (via a style). The third row is a sub-ListView that shows Detail data for the Master SelectedItem in the top ListView.  It's GridRow Height is set to zero by default, and if an item is selected in the Master ListView, it should become visible and have a set height (400 to start, via a binding on the Height of the row). The desired effect is that when an item is selected in the Master ListView, the Detail ListView becomes visible and the GridSplitter allows you to resize the top and bottom as needed.  If necessary, the ScrollBars become visible in the Master ListView to show any items that are now obscured by the Detail ListView (via the automatic scrolling featur

Problem with listview selection

I have the following problem (which I have seen documented in many places with no solution).  I populate a listview.  The steps I use are: Set the ItemsSource to nothing (VB) Set the ItemsSource to the collection to be bound to Set the selected item to nothing (VB) Set the selected item to the first item in the collection The problem is that when I use the down arrow key to change selection in the listview, the first time I use the down arrow nothing happens.  After that first glitch everything works.  I have seen many "solutions" but none that work. Any ideas?? Thanks LLoyd Sheen

listview with button in item template - how do I handle the click event?

Hello,Using a listview control for the first time... I need a button for each item, and of course I need to handle the click event for the buttons... upon clicking a particular button I of course need to know which item the button is associated with so the appropriate action can be taken...In VS, I can't select the button and see my list of available events in the properties window like is normally done for controls outside of templates like this... what do I need to do?

VS2008 and C#: How to create a short cut for a selected item in a ListView/TreeView ?

How to create a short cut for a selected item from a ListView/TreeView ? Is it possible to provide a smaple code ? Thanks,

ListBox/ListView Selection

We are implementing drag/drop on ListBox/ListView items with the extended selection mode. The extended selection mode allows multiple items to be selection simultaneously by holding the shift or control key while selecting additional items.   In Windows Explorer, when an individual item among a group of selected items is clicked, all of the other items are not deselected until the up-click event. This allows an individual to select the desired group and then click and drag this group as a whole to the desired destination.   In WPF, the group appears to be deselected and the individual item selected on the down-click event. This means that in order to drag a group of items, you must hold shift, click and hold the mouse on the desired range of items and then drag the group. If the group is selected first and then the mouse released, the individually clicked item is selected when a drag attempt is made on the group.   We are using WPF, but would like to see the Windows Explorer selection functionality. Any thoughts on how to reconcile these two implementations? The most straight forward fix would be a custom control, possibly derived from ListBox/ListView, but this seems like it might be reinventing the wheel. Seems like the WPF controls are not designed properly here.   Thanks.

Retaining the selection color(default blue Color) for the selected items in ListView when focus is l

I am having a Listview in a form. I have added items(images) to the Listview. When i select the item(Image) in the listview , the item(image) is selected with Default selection Color(Blue). In the same form i have other form added to its container.When i tried to click on the controls of other form, the default selection color(blue) is changing to Grey color. For the lisview i am using property HideSelection = false. How i could maintain the default selection color(blue) even in focus leave of listview? Can any one please suggest me a solution or give me a piece of code. Thanks in Advance, Kumar

Is there a way to have more than 1 "item placeholder" in a listview to accomplish having multiple in

I need to have 3 different sections of a listview act as a repeater, but independen of each other.  Each will have identical column headings, but different datasources.  They will all share the same Heading, but each will have a different footer.  In other words, I need to have 3 different "itemPlaceholders" in one listview. Can that be done. Presently, I have a panel with three listviews nested together.  It works fine except that the formatting of them doesn't stay consistent.  Thanks    

Remove a dynamically added ListViewItem from a ListView

Good day, In my xaml I have created a window in my app which contains a  ListView control. I have programmatically added ListViewItems. The ListViewItems each contain a grid. Grid column 0 contains a textblock, Grid column 1 contains a textbox and Grid column 2 contains a button. What I would like to do is click the button in the ListViewItems grid, and remove the ListViewItem in the button is contained from the ListView. Could anyone suggest a way to do this? I would really appreciate any advice, as this is crucial to the feature I am creating.

C# WPF ListView: ListViewItem content will not update?

I am having a problem updating a listview item which I have bindings set. Here is my XAML code and behind code. Also, the DownloadProgress and DownloadSize do not update but when I debug I see the changes made under the DownloadProgressChanged delegate: mtitem.dlbtn.MouseLeftButtonUp += delegate { MTDLItem dlitem = new MTDLItem(); dlitem.DownloadName = mtitem.tbmusicname.Text; dlitem.DownloadProgress = 0; dlitem.DownloadSize = ""; WebClient wc = new WebClient(); Uri webaddress = new Uri(mtitem.MusicLink); if (mtitem.Group == "5") { } else { string songtitle = mtitem.tbmusicname.Text + @".mp3"; string fixtitle = songtitle.Replace("\\", ""); if (Properties.Settings.Default.CopyRightMessage == false) { if (System.Windows.Forms.MessageBox.Show("GINtech Systems is not responsible for user applications of copyrighted music which may be in violation of existing local, state, or federal laws.", "MusicTuner Disclaimer", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.F
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend