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

  • Home
  • SEARCH
  • 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 1105855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:42:01+00:00 2026-05-17T01:42:01+00:00

I have a problem with bindings in wpf. I’ve discovered a strange problem. I

  • 0

I have a problem with bindings in wpf. I’ve discovered a strange problem. I have class ConfiugrationStringBuilder which inherits from DbConnectionStringBuilder. When I do smth like this

public class ConfiugrationStringBuilder : DbConnectionStringBuilder
{
  public string Directory { get;set; }
}

ConfiugrationStringBuilder builder = new ConfiugrationStringBuilder(connStr);

builder.Directory = "d:\dir"; //my property

txtBox.DataContext = builder;

then add binding to xaml for txtBox

<TextBox Name="txtBox" Text="{Binding Path=Directory}"></TextBox>

The problem is that above code doesn’t work. I can’t bind to my class property, but i can bind to public properies of base DbConnectionStringBuilder.

And the most funniest thing is that when i remove inheritance from DbConnectionStringBuilder

so my code looks like this

public class ConfiugrationStringBuilder
{
  public string Directory { get;set; }
}

In this case the above binding works well. I can’t find any info about such cases and why in this case binding doesn’t work? can somebody explain such behavior?

While I was writing the qusetion I tried to investigate what is a problem. And discovered that DbConnectionStringBuilder has indexer, so when try to bind to Path=Directory on backstage it does builder["Directory"] not builder.Directory. Anyway, can somebody tell me why it is doing so?

  • 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-17T01:42:02+00:00Added an answer on May 17, 2026 at 1:42 am

    It’s a part of the Binding-‘Magic’ to support Master-Detail scenarios (see here for a complete description). Basically, as your object implements IEnumerable, a TextBox will try to bind to as it would a collection – meaning it will be looking for the Current item.

    To work around this issue – I’d probably look to wrapping the DBConnectionStringBuilder instead of inheriting from it (also, you’ll better adhere to composition over inheritance).

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

Sidebar

Related Questions

I have some strange problem in my WPF app. I'm using a MVVM pattern
Problem I have a WPF Toolkit DataGrid , and I'd like to be able
I have a problem with a WPF application. I would like to bind a
My friends, i Have a problem in WPF which i just cannot solve. I
I have the following problem: I made a UserControl in WPF which has an
I'm having a problem with nested bindings with Knockout.JS For example if I have
The problem is basically this, in python's gobject and gtk bindings. Assume we have
Ok, here's a problem I'm having. I have Lua bindings to a rendering engine
I have a problem whit binding in wpf i have a textbox where i
I have a problem with a databinding in WPF. When I try to use

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.