티스토리 뷰

/*
* <ABC.Resources>
*  <Style TargetType="TextBox">
*      <Setter Property="FontSize" Value="25" />
*  </Style>
* </ABC.Resources>
*/
Style^ textStyle = ref new Windows::UI::Xaml::Style(Windows::UI::Xaml::Interop::TypeName(TextBox::typeid));
Setter^ fontSizeSetter = ref new Setter(TextBox::FontSizeProperty, ref new Platform::Box<int>(25));
textStyle->Setters->Append(fontSizeSetter);

myABCControl->Resources->Insert(nullptr, textStyle);

대상이 런타임에 만들어지는 ControlTemplate 이 소스이면 다 소용없고 VisualTreeHelper의 GetChildrenCount / GetChild 와 FrameworkElement::FindName 을 활용해서 찾아야 함. 템플릿이 바뀌면 코드가 꽝나는 건 덤

최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함