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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:39:51+00:00 2026-05-24T02:39:51+00:00

In WPF, how do I access the items of a ListView? I know SelectedValuePath=…

  • 0

In WPF, how do I access the items of a ListView?

I know SelectedValuePath="...", but in my ListView it displays 7 columns.
For example there is GridViewColumn which contains room numbers, I want to put all room number row in list and make this for all column.

  • 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-24T02:39:52+00:00Added an answer on May 24, 2026 at 2:39 am

    WPF handles data sources differently from WinForms. At first, it appears more complicated in WPF because you cannot access the source collection like you are used to in WinForms. However, you will quickly find out WPF makes it more natural to develop against.

    In WPF, you want to bind your UI control (e.g. ListView) to a data source. The data source is just a collection in the code-behind of any custom type you want it to be. As long as you grant the appropriate access to the collection, any of your code-behind can access the source data without talking to the ListView.

    For list views, the data source will be an ObservableCollection on the DataContext with which your view is wired up to. Type T is a custom class type. Through XAML code, you can define a data template on the ListView that describes how properties on your custom class type are displayed for each data item.

    To learn more, research the MVVM UI pattern and study INotifyPropertyChanged interface.

    For instance:

    Code Behind

    internal class MyViewModel
    {
        public ObservableCollection<Person> People = new ObservableCollection<People>();
    
        // code to populate People
    }
    
    public class MyWindow
    {
        public MyWindow()
        {
            DataContext = new MyViewModel();
        }
    }
    

    View

    <ListView ItemsSource={Binding Path=People, Mode=OneWay}>
        <ListView.DataTemplate>
            <Label Content={Binding Path=FirstName, Mode=OneWay} />
            <!-- Blah blah blah -->
        </ListView.DataTemplate>
    </ListView>
    

    This MSDN article goes into detail (see the code snippets and examples at the very bottom).

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

Sidebar

Related Questions

Is there a custom UserControl created in WPF that allows for RDP access. I
How can you access WPF's built-in styles/templates? For example I'm trying to move the
I have an WPF application which access windows services, task schedulers on the local
Is it possible to access all the WPF Items from a winforms Project when
i have a WPF Application with a LoginWindow to access,so i create a Splash
I'm having trouble getting access to my WPF UserControl DependencyProperty values through the UI
I have a .Net 4.0 WPF application that requires an embedded database. MS Access
WPF, Browserlike app. I got one page containing a ListView. After calling a PageFunction
WPF doesn't provide the ability to have a window that allows resize but doesn't
I have a WPF application that mostly follows MVVM, which I am trying to

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.