none
Displaying popup listview/gridview within a Listview/gridview?

    Question

  • Hai guys,

    I have created a listview with gridview. Whenever an item from the listview selected or clicked, a popup listview is to be shown with some more details of the item currently selected.

    How to achieve this functionality in WPF? Is it possible to get it?

    Thanks,

    cssjm

    Tuesday, October 10, 2006 6:10 AM

Answers

  • you can create a popup in XAML and add controls to it.

    for ex:

    <Popup Name="popup1" Width="300" Height="300" Placement="Center" PlacementTarget="{Binding ElementName=win2}">

    <StackPanel Background="Beige">

    <TextBlock Text="{Binding Path=FirstName}"></TextBlock>

    <TextBlock Text="{Binding Path=LastName}"></TextBlock>

    </StackPanel>

    </Popup>

     

    when you want to display the popup, just do something like this

    popup1.DataContext = list1.SelectedItem;

    popup1.IsOpen = true;

    Tuesday, October 10, 2006 9:40 AM
    Moderator
  • You can set StaysOpen Property of the popup to false
    Tuesday, October 10, 2006 12:15 PM
    Moderator

All replies

  • Wouldn't it be easier to use a ToolTip?
    Tuesday, October 10, 2006 6:40 AM
  • Hi Frances,

    It is not possible to use tool tip. My scenrio i want to display some details (as like datagrid or, as drilldown grid) to be shown. But in WPF there is no control like datagrid. So there is no other go and we have to use Listview with gridview. Tooltip is used for just to display some details in textblock.

    Can u get my point correct? Or still not cleared... if not yet cleared pls let me know. How can i get these kind of functionality?

    Tuesday, October 10, 2006 9:25 AM
  • you can create a popup in XAML and add controls to it.

    for ex:

    <Popup Name="popup1" Width="300" Height="300" Placement="Center" PlacementTarget="{Binding ElementName=win2}">

    <StackPanel Background="Beige">

    <TextBlock Text="{Binding Path=FirstName}"></TextBlock>

    <TextBlock Text="{Binding Path=LastName}"></TextBlock>

    </StackPanel>

    </Popup>

     

    when you want to display the popup, just do something like this

    popup1.DataContext = list1.SelectedItem;

    popup1.IsOpen = true;

    Tuesday, October 10, 2006 9:40 AM
    Moderator
  • Hi lee,

    I tried the same way but using procedural code in C# instead of XAML. I have created a listview inside the popup and it displayed. But i trid in some other way as

    popup1.Content = (Button)sender; //using a button and on button click event i displayed the popup

    Whenever i clicked on the button the popup is displayed. Button i want to close the popup if button lost its focus or if we click the mouse outside anywhere(within the list view or within the window other than button).

    I tried using Lostfocus event of button and also mouseleave event. In the mouseleave event the popup is closed whenver the mouse left from button. I need to select the values from the popup listview. but i didnt able to select items from the popup. Because as soon as mouse moves little bit the popup is closed.

    Can you get my point clearly? If so how can i achieve the result.

    Thankfully,

    cssjm

    Tuesday, October 10, 2006 12:13 PM
  • You can set StaysOpen Property of the popup to false
    Tuesday, October 10, 2006 12:15 PM
    Moderator
  • Hi lee,

    Thanks it is now working fine as of now... and in future if any other need araise i post my query to u..

    Thankfully,

    cssjm

    Tuesday, October 10, 2006 1:25 PM