How to get the text with in the datatemplate?
- by rakish
I have used below code
<DataTemplate x:Key="myTemplate">
<TextBlock Text="Hi"></TextBlock>
</DataTemplate>
in this case i can able to get the textblock text by using below code
DataTemplate myTemplate = this.Resources["myTemplate"] as DataTemplate;
TextBlock rootElement = myTemplate.LoadContent() as TextBlock;
//I can get the text "rootElement.text "
but when i use binding means i cant able to get the text
<DataTemplate x:Key="myTemplate">
<TextBlock Text="{Binding EmployeeName}"></TextBlock>
</DataTemplate>