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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:19:07+00:00 2026-05-12T10:19:07+00:00

How do you get the content of a single cell of a WPF toolkit

  • 0

How do you get the content of a single cell of a WPF toolkit DataGrid in C#?

By content I mean some plain text that could be in there.

  • 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-12T10:19:07+00:00Added an answer on May 12, 2026 at 10:19 am

    Following what Phillip said – the DataGrid is usually data-bound. Below is an example where my WPF DataGrid is bound to an ObservableCollection<PersonName> where a PersonName is comprised of a FirstName and LastName (both strings).

    The DataGrid supports automatic column creation so the example is quite simple. You’ll see that I can access rows by their index and get the value of a cell in that row by using the property name that corresponds to the column name.

    namespace WpfApplication1
    {
        /// <summary>
        /// Interaction logic for Window1.xaml
        /// </summary>
        public partial class Window1 : Window
        {
            public Window1()
            {
                InitializeComponent();
    
                // Create a new collection of 4 names.
                NameList n = new NameList();
    
                // Bind the grid to the list of names.
                dataGrid1.ItemsSource = n;
    
                // Get the first person by its row index.
                PersonName firstPerson = (PersonName) dataGrid1.Items.GetItemAt(0);
    
                // Access the columns using property names.
                Debug.WriteLine(firstPerson.FirstName);
    
            }
        }
    
        public class NameList : ObservableCollection<PersonName>
        {
            public NameList() : base()
            {
                Add(new PersonName("Willa", "Cather"));
                Add(new PersonName("Isak", "Dinesen"));
                Add(new PersonName("Victor", "Hugo"));
                Add(new PersonName("Jules", "Verne"));
            }
        }
    
        public class PersonName
        {
            private string firstName;
            private string lastName;
    
            public PersonName(string first, string last)
            {
                this.firstName = first;
                this.lastName = last;
            }
    
            public string FirstName
            {
                get { return firstName; }
                set { firstName = value; }
            }
    
            public string LastName
            {
                get { return lastName; }
                set { lastName = value; }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am aware that the maximum length of a single HSSF Workbook cell's content
In my app I get JSON content as InputStream. Depending if its a single
How would I get content from HTML between h3 tags inside an element that
I have a PHP script that does the following: Uses file_get_contents() to get content
I have a webpage which content(single div and a lot of text with formatting)
I have a single data context (created once), and I use it to get
How can I get content of a DIV using regular expression. What I need
I'm trying to get content from an RSS2 feed from one of my sites
I have written simple code to get content from xml file to php. $xml
What i basically want to do is to get content from a website and

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.