Content컨트롤에 DataTemplate 붙혔을때, 템플릿의 컨트롤 찾는 방법.


  1. Content컨트롤에 템플릿을 로드시키면 실제로는 Content의 자식인 ContentPresenter에 할당이 된다.
  2. 따라서 먼저 VisualTreeHelper.GetChild(컨텐트, 0) 해서 찾자
  3. ApplyTemplate() 해줘야 반영이 되는 경우가 있다.
  4. 컨텐트컨트롤.ContentTemplate.FindName("이름", 찾은 contentPresenter) 해서 찾자.

댓글

이 블로그의 인기 게시물

Oracle NLS_DATE_FORMAT 변경

Stop console process using Ctrl+C.

Alternative to IValueConvert, QuickConverter