■ Button 클래스의 SetResourceReference 메소드를 사용해 리소스를 설정하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 |
using System.Windows.Controls; ... Button button; ... button.SetResourceReference(Button.StyleProperty, "RedForegroundStyleKey"); |
※ 찾고자 하는 리소스가 존재하지 않는 경우 리소스를 적용하지 않는다.