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 9064105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:09:52+00:00 2026-06-16T16:09:52+00:00

I have read this topic: how to delete a specific text / message showed

  • 0

I have read this topic:
how to delete a specific text / message showed in a ListView ?

It works fine in winform (I have test it!) but in WPF it does not work.

I want to find a text of the firstnametxt in listview1 and compare it to Firstname Column items and if its true then delete the item (the row that contains the item)

But I do not know how to handle this in WPF.

Part of my code is like this:

XAML:

<ListView Name="listView1 HorizontalAlignment="Left" VerticalAlignment="Top" />
    <ListView.View>
        <GridView>
            <GridViewColumn Header="FirstName" DisplayMemberBinding="{Binding Path=FirstName}"  />
            <GridViewColumn Header="LastName" DisplayMemberBinding="{Binding Path=LastName}" />
        </GridView>
    </ListView.View>
</ListView>
<TextBox Name="firstnametxt" Height="27" HorizontalAlignment="Left" Margin="271,20,0,0"  VerticalAlignment="Top" Width="181" />
<Button Content="Add" Height="38" HorizontalAlignment="Left" Margin="310,242,0,0" Name="button1" VerticalAlignment="Top" Width="74" Click="button1_Click" />
<Button Content="Find" Height="38" HorizontalAlignment="Left" Name="button2" VerticalAlignment="Top" Width="74" Click="button2_Click" />

Code behind (C#):

public class Familiy
{
    public Familiy(string firstname, string lastname)
    {
        this.FirstName = firstname;
        this.LastName = lastname;
    }
    private string firstname;

    public string FirstName
    {
        get { return firstname; }
        set { firstname = value; }
    }
    private string lastname;
    public string LastName
    {
        get { return lastname; }
        set { lastname = value; }
    }
}


private void button1_Click(object sender, RoutedEventArgs e)
{ 
    ///////////////////////////
}
  • 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-16T16:09:54+00:00Added an answer on June 16, 2026 at 4:09 pm

    You will need to alter the ListBox’s ItemSource wether it be a ItemList, List or another collection Type this example uses a List of Familily.

    public partial class MainWindow : Window
    {
        List<Familiy> familiys = new List<Familiy>();
        public MainWindow()
        {
            InitializeComponent();
    
    
            familiys.Add( new Familiy("FirstName1", "LastName1"));
            familiys.Add(new Familiy("FirstName2", "LastName2"));
            familiys.Add(new Familiy("FirstName3", "LastName3"));
            familiys.Add(new Familiy("FirstName4", "LastName4"));
            listView1.ItemsSource = familiys;
    
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            familiys.Remove(familiys.Find(delegate(Familiy f) { return f.FirstName == firstnametxt.Text; }));
            listView1.ItemsSource = "";
            listView1.ItemsSource = familiys;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read a few bits and bobs online about this topic but found
I have read many Forums on this topic but I still haven't found an
I have read many questions on SO about this topic but I can seem
I have read questions and answers about this topic but I still have some
I have read this topic: Avoiding != null statements but I don't see benefits.
I have read other questions on this topic but none that actually answers my
I have read several posts on this topic, but have yet to find a
I have read through some articles on this topic but I am still cautious
I have read really a lot of posts about this topic, however nothing works
I'v read this topic but still have not complete picture and I would really

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.