How to Access a Control present inside a DataTemplate

Posted by Subhen on Stack Overflow See other posts from Stack Overflow or by Subhen
Published on 2010-05-27T11:11:00Z Indexed on 2010/05/28 10:22 UTC
Read the original article Hit count: 348

Hi,

I have Few TextBlock inside the Data template as follow:

 <DataTemplate>
    <StackPanel x:Name="stackPanelItems" Orientation="Horizontal">
        <TextBlock  x:Name="myTextBox" HorizontalAlignment="Center" VerticalAlignment="Top"   FontSize="14" />
    </StackPanel>
  </DataTemplate>

Now we need to Make the myTextBox Collsapsed in some scenarios but dont want to use the loaded or click event and then access the control via sender.

Can I used any other method or way?

Thanks,

Subhen

© Stack Overflow or respective owner

Related posts about wpf

Related posts about Silverlight