Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#comboboxdisplayText, +
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
Edited 3-Oct-12 19:28pm
sant.rajas at 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
0 Sergey Alexandrovich Kryukov 529
1 OriginalGriff 307
2 Damith Weerasinghe 295
3 ravikhoda 260
4 Tadit Dash 180
0 Sergey Alexandrovich Kryukov 10,974
1 OriginalGriff 6,667
2 Peter Leow 4,760
3 Abhinav S 3,813
4 Maciej Los 3,565

Advertise | Privacy | Mobile
Web01 | 2.8.140421.2 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid