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

  • SEARCH
  • Home
  • 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 8407745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:27:03+00:00 2026-06-09T23:27:03+00:00

I have a ListView in a .xaml window and in it are a list

  • 0

I have a ListView in a .xaml window and in it are a list of entries. Here is the important code:

<ListView Grid.Row="1" Name="findList" BorderThickness="0" Margin="-4,26,-4,-4">
    <ListView.ItemContainerStyle>
        <Style TargetType="ListViewItem">
            <EventSetter Event="MouseDoubleClick" Handler="OnFindItem"></EventSetter>
        </Style>
    </ListView.ItemContainerStyle>
    <ListView.View>
        <GridView>
            <GridViewColumn Header="ID" DisplayMemberBinding="{Binding Path=ID}" Width="32"/>
            <GridViewColumn Header="Key" DisplayMemberBinding="{Binding Path=Key}" Width="140"/>
            <GridViewColumn Header="English" DisplayMemberBinding="{Binding Path=English}" Width="250"/>
            <GridViewColumn Header="Translated Language" DisplayMemberBinding="{Binding Path=Translation}" Width="250"/>
        </GridView>
    </ListView.View>
</ListView>

When a user double clicks on one of the entries it goes to OnFindItem in my C# file. The specific block of code for it is (although completely broken) here:

private void OnFindItem(object sender, RoutedEventArgs e)
    {
        ListViewItem output = e.Source as ListViewItem;
        if (output != null)
        {
            //More code here.
        }
    }

No matter what I seem to adjust in this little bit of code in C#, I don’t seem to be able to read the contents of the row the user double clicked on. I’ve checked many web pages including pages on SO and MSDN and the such for solutions, but being very new to C# I just cannot see what I’m supposed to do here.

Thanks in advance, anyone that is able to help!

  • 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-06-09T23:27:05+00:00Added an answer on June 9, 2026 at 11:27 pm

    I finally found the solution to my problem. The C# code should have been as follows:

    private void OnFindItem(object sender, RoutedEventArgs e)
        {
            ListViewItem output = e.Source as ListViewItem;
    
            if (output != null)
            {
                DataRowView rowView = output.Content as DataRowView;
                if (rowView != null)
                {
                    //More code here.
                }
             }
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
I have this very simple XAML window: <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <ContentControl Content={Binding
I have a ListView in a WPF window containing a number of GridViewColumns. The
I have 3 controls in a WPF window.. a textbox, listbox and listview. The
In WPF app I have a ListView : <ListView Height=100 Width=434 x:Name=lvItems ItemsSource={Binding ElementName=MainWindow,
I have the following xaml which resides in a wpf user control - <Grid>
I have a ListView in a Windows Form that I bind a list of
My situation is like following. I have a App.xaml which includes Style for ListView
I have a 2X2 Grid that is filled with 2 Listview controls and some
In my WPF application (XAML posted below), I have a List View and below

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.