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

The Archive Base Latest Questions

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

I was trying to bind my DataGrid columns to a list where the item

  • 0

I was trying to bind my DataGrid columns to a list where the item for a column could be retrieved using an indexer. The indexer type is DateTime.

I am creating the DataGrid columns using code and wanted to create a binding to retrieve the value from the list. In XAML the path would be written as:

{ Binding Path=Values[01/01/2011] }

But since I am doing it in code behind I need to define the path using a PropertyPath, like so:

new Binding{
    Path = new PropertyPath("Values[01/01/2011]")
}

There is another overload for the constructor that takes a path and an array of parameters. According to the documentation the parameters are used for indexers. But when I write my binding as

new Binding {
    Path = new PropertyPath("Values", new DateTime(2011, 01, 01))
}

the binding cannot resolve the path. Fair enough, I’m not stating that it should look for an indexer. But if I write it as:

new Binding{
Path = new PropertyPath(“Values[]”, new DateTime(2011, 01, 01))
}

then DateTime.MinValue is passed to the indexer.

Can someone explain to me how I use the PathParameters in the constructor and how I can bind to indexers without having to do a ToString on my value in the actual path?

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

    Based on this MSDN article, you’d need to include “(0)” to indicate where the parameter should be placed. So the following should work:

    new Binding {
        Path = new PropertyPath("Values[(0)]", new DateTime(2011, 01, 01))
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to bind a DataGrid to a generic list in WPF. The
I'm trying to bind FontWeight in datagrid to a property in code and getting
I'm trying to bind a list of custom objects to a WPF Image like
I'm trying to bind a list of integers into an SQLTemplate IN clause like
I have a custom class Contact . I am trying to bind a List<Contact>
i am trying to use this code to bind my asp.net menu control to
I am trying to bind my data table inventorytable to the datagrid viewer.the problem
I'm trying to bind datagrid to xml: <StackPanel.DataContext> <XmlDataProvider Source=bill.xml XPath=/Foods/Food/> </StackPanel.DataContext> <DataGrid Width=190
I'm trying to bind a list of objects to a list box. Each object
I am trying to bind a CData element to a text box, in code.

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.