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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:53:04+00:00 2026-05-25T15:53:04+00:00

Just getting confused when trying to display certain things when utilising itemssource, datacontexts and

  • 0

Just getting confused when trying to display certain things when utilising itemssource, datacontexts and binding.

public class Date
{
    public DateTime _WeekDate;
    public ICollectionView _WeekData;
}

public class MainWindowViewModel
{
    public ICollectionView WeekDates { get; private set; }

    public MainWindowViewModel()
    {
        List<Date> _dates = new List<Date>();

        //Code to populate _dates

        WeekDates = CollectionViewSource.GetDefaultView(_dates);
    }
}

public MainWindow()
{
    InitializeComponent();

    _ViewModel = new MainWindowViewModel();
    gMain.DataContext = _ViewModel;
}

So as you can see I’ve got a collection of a class called Date, which has a DateTime and another collection inside it. This is all created in a ViewModel which is attached to a grid as a data context.

Within this grid I have a combobox which needs to display the DateTime value listed in each Date class within the collection. So with much messing about I have this:

<ComboBox ItemsSource="{Binding Path=PickupDates}" DisplayMemberPath="WeekDate" />

This has worked however I also want a binding converter to be applied to the MemberPath to change the style in which the date will be displayed. But applying it this way I can’t add the Converter. To no avail, I’ve tried things such as:

<ComboBox ItemsSource="{Binding Path=PickupDates}" DisplayMemberPath="{Binding Path=WeekDate", Converter={StaticResource DateFormatter}/>

Any ideas? Or any better ways of doing this?

Thanks in advance,
SumGuy

  • 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-25T15:53:04+00:00Added an answer on May 25, 2026 at 3:53 pm

    You can’t bind to the DisplayMemberPath but what you can do is provide a property within your bound object, similar to WeekDate in the working example you provided, that returns the WeekDate in the format you wish. When WeekDate is set, raise the propertychanged event for the new formatting property.

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

Sidebar

Related Questions

I am trying to grok Mercurial and hope I am just getting confused here!
Just getting started with Linq to SQL so forgive the newbie question. I'm trying
I'm trying to finalize a signup process for my webapp, but am getting confused
Im trying to get into some basic JavaFX game development and I'm getting confused
I am trying to override the DateTime template since I need custom class names
This completely confused me for a while. I'm getting weird behaviour trying to loop
I am really getting confused on how pointers work. I am trying to write
I'm kind of just getting started with Python, and I'm trying to match the
Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me.
Just getting started using MVC in ASP.NET, I'm going to have it so users

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.