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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:56:29+00:00 2026-06-17T07:56:29+00:00

I have a ListView which has it’s table filled out with a ListItemCollection I

  • 0

I have a ListView which has it’s table filled out with a ListItemCollection I am creating and managing programmatically.

I want to check which of the controls have received any kind of input, currently I am focused on any kind of TextInput. I do not have any idea how to find exactly which column and row this control is from (by name or id, whichever is easiest).

A solution to this problem in a usual Windows Forms application would be programmatically assigning a unique name to each control. With a template such as [control name]_[row], such as itemName_1.

It doesn’t seem possible to modify the name of a control generated by a ListItemCollection. I also tried binding a control with Path="x", however XAML prevents using the binding tag with the name property.

What is a good solution to this problem, where I can somehow detect which exact control was interacted with, without searching through all of them?

Here is what I have right now (in the picture only one row was created):
enter image description here

  • 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-17T07:56:30+00:00Added an answer on June 17, 2026 at 7:56 am

    The problem here is that you use WPF in a WinForms way. It’s not meant to be used like that, and so you end up doing intricate and bogus things.

    Here is what you should do :

    Let’s say we are manipulating an order containing order details.

    We first create classes to hold our data

    public class Order : INotifyPropertyChanged
    {
       private readonly ObservableCollection<OrderDetail> m_details = new ...
    
       public ObservableCollection<OrderDetail> Details { get { return m_details; } }
    
       public decimal Total {
         get {
           decimal total = 0.0;
           foreach(var detail in m_details) total += detail.SubTotal;
           return total;
         }
       }
    }
    
    public class OrderDetail : INotifyPropertyChanged
    {
       private readonly Order m_order;
    
       public OrderDetail(Order order) {
         m_order = order;
       }       
    
       private string m_name;
       public string Name
       {
         get { return m_name; }
         set {
           if(m_name != value) {
             m_name = value;
             RaisePropertyChanged("Name");
           }
         }
       }
       private int m_amount;
       public int Amount {
         get { return m_amount; }
         set {
           if(m_amount != value) {
             m_amount = value;
             RaisePropertyChanged("Amount");
             RaisePropertyChanged("SubTotal");
             m_order.RaisePropertyChanged("Total");
           }
         }
       }
       private decimal m_unitPrice;
       public decimal UnitPrice {
         get { return m_amount; }
         set {
           if(m_unitPrice!= value) {
             m_unitPrice = value;
             RaisePropertyChanged("UnitPrice");
             RaisePropertyChanged("SubTotal");
             m_order.RaisePropertyChanged("Total");
           }
         }
       }
       public decimal SubTotal { get { return Amount * UnitPrice; } }
    }
    

    And then we gonna create a view to visualize and edit our data

    ...
    <ListView ItemsSource="{Binding MyOrder}">
      <ListView.View>
        <GridView>
          <GridViewColumn>
            <GridViewColumn.CellTemplate>
              <DataTemplate>
                <TextBox Text="{Binding Name}"/>
              </DataTemplate>
            </GridViewColumn.CellTemplate>
          </GridViewColumn>
          ...
        </GridView>
      </ListView.View>
    </ListView>
    <StackPanel Orientation="Horizontal">
      <TextBlock Text="Total: "/>
      <Textblock Text="{Binding MyOrder.Total}"/>
    </StackPanel>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom adapter for my ListView which has multiple TextViews. I want
I have a ListView which has custom elements inside of it. I want to
I have a listview which has a bunch of selections. I want to keep
I have listview which has 5000 items. I want to get item of listview
I have a ListView and need to check, which item has been clicked. The
I have a listview which has its datasource changed after update of a search
I have a Custom ListView which has an ImageView and a TextView. and i
I have ListView in my project which has ListItems as in the form of
I have a ListView which contains custom rows. This custom row has following UI
I have a tab view which has a listview in one of these tabs.

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.