Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6552131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:25:23+00:00 2026-05-25T12:25:23+00:00

In my WPF application, I have a ListView on the main form that displays

  • 0

In my WPF application, I have a ListView on the main form that displays bound data from a DataSet. When a user double-clicks a row in the ListView, it opens a detail window.

In my XAML, I used a style to create a double click handler on the listview:

<Style x:Key="ListViewDoubleClick" TargetType="{x:Type ListViewItem}">
    <EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick" />
</Style>
...
<ListView Name="searchResults" ItemContainerStyle="{StaticResource ListViewDoubleClick}>

In the code-behind, I have a Dictionary that keeps track of the open Details windows (multiple can be open at a time) so that if a detail window is already open, it’s brought to the front. I handle the double-click like so:

private void HandleDoubleClick(object sender, MouseEventArgs e)
{
    DataRowView clickedRow = ((ListViewItem)sender).Content as DataRowView;
    int row = (int)clickedRow.Row["ID"];
    if (!displayedCards.ContainsKey(row))
    {
        DetailWindow window = new DetailWindow(RetrieveData(row));
        //window.Owner = this;
        displayedCards.Add(row, window);
        window.Show();
    }
    else
    {
        displayedCards[row].Activate();
    }
}

My problem is that with the code like it is above, the detail windows are opened behind the main form. If I set the owner information (window.Owner = this), the detail windows are opened on top of the main form, but the main form is never able to come in front of the detail windows.

The displayedCards[row].Activate() works as I expected, bringing that detail window to the front of all other detail windows, but it falls victim to the same problem as above – it doesn’t come in front of the main window.

What I want to accomplish is to have the detail windows on the same level/layer (/z order?) as the main window so that both can appear on top of one another, and to have the detail windows show up on top of the main form when they are opened.

Edit: If it’s important, the detail window has no WindowStyle and AllowsTransparency is set to true. I also don’t have a window title and the window doesn’t appear in the taskbar. When trying to figure this out, I tried setting the WindowStyle to SingleBorderWindow, and the same problem occurs, except that the border of the detail window is shown on top of the main form as the detail window is being drawn, and then it’s pushed behind the main form. Could my double-click handler essentially be pulling the main form to the front after the detail window is shown?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:25:23+00:00Added an answer on May 25, 2026 at 12:25 pm

    It looks like you aren’t telling the event routing system that you have handled the event. Try setting e.Handled to true to tell WPF to not allow any further processing of your events. See RoutedEventArgs.Handled Property and Marking Routed Events as Handled, and Class Handling for more information on how the Handled property changes event routing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WPF Application where I have One main form and other user controls
I have a ListView in a WPF Application that use Dynamic Binding . I
In a WPF application I have a ListView: <ListView Name=ItemSelList ItemsSource={Binding ItemColl} SelectionChanged=ItemSelList_SelectionChanged> <ListView.View>
In my WPF application I have a CheckBox whose IsChecked value is bound to
In my WPF application I have a View that is given a ViewModel, and
I have written a WPF application that I want to port to Silverlight 2.
I have a ListView and ObservableCollection in my wpf application. I want to bind
I have an action Edit in my WPF application, which is bound to items
In my Composite WPF application I have an event that is published when the
In my WPF Application I have an GridViewColumn that looks like this: <GridViewColumn Width=170>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.