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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:15:40+00:00 2026-05-23T16:15:40+00:00

Im just getting to grips with databinding, Im struggling with binding to properties that

  • 0

Im just getting to grips with databinding, Im struggling with binding to properties that are nested within an ObservableCollection further down the object, namely In a DataTemplate of a ListView I am trying to bind to the Day.DayDate property below.

Its a diary app & this is its structure (edited to keep it brief) :

public class Month : INotifyPropertyChanged
{
    public DateTime StartDate { get; set; }
    public ObservableCollection<Day> Days { get; set; }
}

public class Day : INotifyPropertyChanged
{
    public DateTime DayDate { get; set; }
    public ObservableCollection<Gig> Gigs { get; set; }
}

public class Gig : INotifyPropertyChanged
{
    // Properties of a gig
}

I initially populate the Months Days like this:

private void InitMonth(Month calendarMonth)
{
    // create a Day Object for each day of month, create a gig for each booking on that day (done in LoadDay)
    int daysInMonth = DateTime.DaysInMonth(calendarMonth.StartDate.Year, calendarMonth.StartDate.Month);
    Day dc;
    for (int day_cnt = 0; day_cnt < daysInMonth; day_cnt++)
    {
        dc = new Day();
        dc.DayDate = calendarMonth.StartDate.AddDays(day_cnt);
        calendarMonth.Day.Add(dc);
    }
}

I want my Main Window to have three sections:

  1. Month ListView (showing all its Days)
  2. Day ListView (showing selected Days Gigs)
  3. Content Control (showing selected Gigs gig properties)

Im stuck on part 1, My Xaml looks like this :

<StackPanel>
  <TextBlock Text="{Binding Path=StartDate, StringFormat={}{0:MMMM}}"/>// Month Heading
  <ListView Name="lv_month"
    ItemsSource="{Binding}"
    ItemTemplate="{StaticResource dayItem}">// Each Day in Month
  </ListView>
</StackPanel>

<DataTemplate x:Key="dayItem">
  <StackPanel>
    <TextBlock Text="{Binding Path=Day.DayDate, StringFormat={}{0:dd ddd}}" />
  </StackPanel>
</DataTemplate>

In the TextBlock, Binding to the Months StartDate works fine, then I want to show all the Months Day Objects DayDate (upto 31, ie 01 Sat through to 31 Mon) listed underneath.

Its not showing Day.DayDate! How do I bind to it?

You can see at the moment ‘Path=Day.DayDate’ but I have tried just about every possibility which leads me to believe im approaching this from the wrong angle.

Any help greatly appreciated

  • 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-23T16:15:41+00:00Added an answer on May 23, 2026 at 4:15 pm

    Your ItemsSource of the ListView of your Month template needs to bind to Days:

    Change

    ItemsSource="{Binding}"
    

    to

    ItemsSource="{Binding Days}"
    

    Secondly, consider each template as handling that object, so change this:

    <TextBlock Text="{Binding Path=Day.DayDate, StringFormat={}{0:dd ddd}}" />
    

    To

    <TextBlock Text="{Binding Path=DayDate, StringFormat={}{0:dd ddd}}" />
    

    And it should work! 😉

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

Sidebar

Related Questions

I'm just getting to grips with IIS7 redirect and having problems doing something that
I'm just getting to grips with OOP PHP and while I have understood it
I'm just getting to grips with GUI programming in java. Here is a trivial
I'm just getting to grips with JPA in a simple Java web app running
I'm just finished my first month of getting to grips with flex. All of
I'm just getting started with silverlight. Basically I have a silverlight user control that
I'm just getting to grips with Tomcat and mySQL using the resource sharing method.
I'm just getting to grips with custom validation attributes, and I'm trying to write
Just getting to grips with this jquery and ajax thing. I want to run
I'm just getting to grips with TFS 2010 (never had any luck with TFS

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.