tags:

views:

33

answers:

2

Hi,

I am using WPF and I have Datatemplate that is i want to access into the codebihind how i can use this...\

Thanks..

A: 

Can you give more details what you want to do in the Codebehind?

Ragunathan
This should have been a comment instead of an answer
Wallstreet Programmer
I don't know how to add comment for a question.
Ragunathan
I want to Treelistview assign into the combobox and the combobox is a datatemplate so how I can do this into code behind..
Jitendra Jadav
+1  A: 
<Window.Resources>
  <DataTemplate x:Key="PersonDataTemplate">
    <StackPanel Orientation="Horizontal">
      <TextBlock Text="{Binding Path=Name}" />
      <TextBlock Text="{Binding Path=Age}" />
    </StackPanel>
  </DataTemplate>
</Window.Resources>

public Window1()
{
  InitializeComponent();

  DataTemplate dataTemplate = FindResource("PersonDataTemplate") as DataTemplate;
}
Wallstreet Programmer