Click here to Skip to main content
13,003,709 members (59,944 online)
Rate this:
Please Sign up or sign in to vote.
I am trying to Bind the TextBlock inside ComboBox through Code. I am able to bind the textblock sucessfully but For some reasons TextBlock doesnt display Text Values.

I have mechanism which checks for the selected values and there I am getting the selected values without any problem.

So to conclude, My binding is working fine but I am missing out something hence textblock is not displaying text that is bound with it.

This is the code I am using for Binding:
where "lObjTextBlock" is TextBlock inside of ComboBox.
Binding lObjBinding = new Binding();
lObjBinding.Path = new PropertyPath("[" + lObjMap.PropertyName + "]");
lObjTextBlock.SetBinding(TextBlock.TextProperty, lObjBinding);

This is the XAML for the TextBlock:
<my:HComboBox Name="cmbRefDoctor">
                    <TextBlock x:Name="txtRefDoctorName" />

Once again : My problem is that TextBlock is not displaying any Text althought values are being set.

Would love to get all possible suggestions. Thanks in advance.
Posted 3-Oct-12 19:25pm
Updated 3-Oct-12 19:28pm
sant.rajas 4-Oct-12 9:50am
Later on I realized that Using LoadContent gives the another instance of TextBlock so its of no use to me.

Now I am trying to find the other way to do same thing.

To Find the TextBlock control and then bind it in code behind.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170626.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100