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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:49:54+00:00 2026-05-27T13:49:54+00:00

How do I take a basic class that I’ve made and extract it’s properties

  • 0

How do I take a basic class that I’ve made and extract it’s properties in the list in WPF? I’ve already tried playing with the itemssource property but nothing seems to have worked for me.

Public Class PageContent
    Public StartDate As DateTime
    Public Header As String
    Public Content As String
End Class

<ListView Name="grid_PageContentList" >
     <ListView.View>
       <GridView>
            <GridViewColumn  DisplayMemberBinding="{Binding StartDate}" Width="50"></GridViewColumn>
            <GridViewColumn DisplayMemberBinding="{Binding Header}" Width="50"></GridViewColumn>
            <GridViewColumn DisplayMemberBinding="{Binding Content}" Width="50"></GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>
  • 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-27T13:49:55+00:00Added an answer on May 27, 2026 at 1:49 pm

    You cannot bind directly to fields, you need to use properties instead:

    Public Class PageContent
        Public Property StartDate As DateTime
        Public Property Header As String
        Public Property Content As String
    End Class
    

    Also you need to ensure you have set you DataContext. If you have just a simple form with a code behind approach then put this in the constructor or Loaded handler:

    Class MainWindow 
    
        Public Sub New()
    
            InitializeComponent()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Loaded
            MyData = New List(Of PageContent)
            Dim pc As New PageContent
            pc.Header = "AAAAAAAA"
            pc.StartDate = Now
            MyData.Add(pc)
    
            pc = New PageContent
            pc.Header = "BBBBBB"
            pc.StartDate = Now.AddMinutes(1)
            MyData.Add(pc)
    
    
            DataContext = Me
        End Sub
    
    
        Public Property MyData() As List(Of PageContent)
    
    End Class
    

    And set your ItemsSource in your XAML:

        <ListView Name="grid_PageContentList" ItemsSource="{Binding MyData}" >
            <ListView.View>
                <GridView>
                    <GridViewColumn  DisplayMemberBinding="{Binding StartDate}" Width="50"></GridViewColumn>
                    <GridViewColumn DisplayMemberBinding="{Binding Header}" Width="50"></GridViewColumn>
                    <GridViewColumn DisplayMemberBinding="{Binding Content}" Width="50"></GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For fun, I'm playing with a class to easily cache function results. The basic
I am trying to take some functions that I've made and tested with in
The basic idea is to take a string and evaluate it against an XML
I have a basic PHP question, take the code below for example, let's say
I would like to better understand the basic steps needed to a take an
Take the following snippet: List<int> distances = new List<int>(); Was the redundancy intended by
Take the following C# class: c1 { event EventHandler someEvent; } If there are
Imagine I have a class that represents a simple washing machine. It can perform
I have this basic setup: enum{ BASE, PRIMITIVE, ... }; class IUnknown{ public: bool
I'm creating a basic database application in WPF, and I have started using the

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.