0

how do i access a textblock inside a data template which is embedded within a ListBox? I wish to assign a new value to the textblock's attribute such as MaxHeight.

Code-behind as well?

brainsfrying
  • 241
  • 1
  • 6
  • 21

1 Answers1

0

I think I got time a go a similiar porblem to yours. Check this Q&A with final mine resolution of my specific problem. Find an element in DataTemplate.

It's actually kind of triccky.

Hope this helps.

Regards.

Community
  • 1
  • 1
Tigran
  • 61,654
  • 8
  • 86
  • 123
  • Thanks so much for the response. Can you provide me with more information as well? I do not understand the supposed link :c – brainsfrying Jul 29 '11 at 09:21
  • It was kind of 2 years ago, but the basic idea is to recover real, in your case, ListBox control with already attached DataTemplate, where you can find desired control. For this subscribe to DataTemplate's Loaded event, and you will recieve like a parameter the "real" ListBox. – Tigran Jul 29 '11 at 09:31
  • Much appreciated. Will go try it out! :) – brainsfrying Jul 29 '11 at 09:40
  • Hi Tigran, i cannot even assign a x:key to ? – brainsfrying Jul 29 '11 at 10:02