Click here to Skip to main content

sant.rajas asked:

Open original thread
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">
	<my:HComboBox.ItemTemplate>
		<DataTemplate>
                    <TextBlock x:Name="txtRefDoctorName" />
		</DataTemplate>
	</my:HComboBox.ItemTemplate>
</my:HComboBox>
 

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.
Tags: C#, combobox, display, Text, Silverlight5

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
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