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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:12:01+00:00 2026-05-21T20:12:01+00:00

I have a binding of the form: Path=SpecialCollection[0] The SpecialCollection class extends ObservableCollection and

  • 0

I have a binding of the form:

Path=SpecialCollection[0]

The SpecialCollection class extends ObservableCollection and has an indexer property.

public T this[string propertyValue]
{
    get
    {
        // do stuff
        return default(T);
    }
}

My problem is that the binding attempts to get the indexer property value, instead of returning the 0th item in the collection. Is there a way to force the binding to treat 0 as an integer so it returns a collection element, instead of invoking the collection’s indexer property’s getter?

  • 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-21T20:12:01+00:00Added an answer on May 21, 2026 at 8:12 pm

    According to MSDN you can tell the binding the type of the value entered as index:

    Inside indexers you can have multiple indexer parameters separated by commas (,). The type of each parameter can be specified with parentheses. For example, you can have Path=”[(sys:Int32)42,(sys:Int32)24]”, where sys is mapped to the System namespace.

    I noticed that the Binding constructor taking a path string uses another PropertyPath constructor than the default PropertyPath type converter, said PropertyPath constructor does not work in this scenario. To avoid the problem avoid the Binding constructor by setting the Path property manually which invokes the conversion via type converter.

    <!-- Does not work -->
    <TextBlock Text="{Binding [(sys:Int32)0]}"/>
    <!-- Does work -->
    <TextBlock Text="{Binding Path=[(sys:Int32)0]}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some user controls, I have this binding: AppLanguage={Binding Path=ApplicationLanguage, Source={x:Static Application.Current}} This works
Concerning data binding I have these classes: public class Foo : List<Bar> { public
i have 2 textblocks in my form. something like this: <TextBlock Name=applicationname Text={binding applicationname?}/>
In a form, I have a TextBox Binding an Object on its member property
I have a command object associated with a spring form controller: public class PluginInstance
I have this in my form's designer code: this.referenceNumberTextBox.DataBindings.Add(new System.Windows.Forms.Binding(Text, this.clientDetailBindingSource, ClientDetails.ReferenceNumber, true)); In
I've got some Columns in a DataGridView that have their Binding property set to
I have a jquery ui dialog with a knockoutjs submit binding on a form.
I have trouble with binding Boolean property in association classes. Property is set to
I'm having problems binding on a form with multiple models being submitted. I have

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.