CustomControl1.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace OHV.UIControl
  16. {
  17. /// <summary>
  18. /// XAML 파일에서 이 사용자 지정 컨트롤을 사용하려면 1a 또는 1b단계를 수행한 다음 2단계를 수행하십시오.
  19. ///
  20. /// 1a단계) 현재 프로젝트에 있는 XAML 파일에서 이 사용자 지정 컨트롤 사용.
  21. /// 이 XmlNamespace 특성을 사용할 마크업 파일의 루트 요소에 이 특성을
  22. /// 추가합니다.
  23. ///
  24. /// xmlns:MyNamespace="clr-namespace:OHV.UIControl"
  25. ///
  26. ///
  27. /// 1b단계) 다른 프로젝트에 있는 XAML 파일에서 이 사용자 지정 컨트롤 사용.
  28. /// 이 XmlNamespace 특성을 사용할 마크업 파일의 루트 요소에 이 특성을
  29. /// 추가합니다.
  30. ///
  31. /// xmlns:MyNamespace="clr-namespace:OHV.UIControl;assembly=OHV.UIControl"
  32. ///
  33. /// 또한 XAML 파일이 있는 프로젝트의 프로젝트 참조를 이 프로젝트에 추가하고
  34. /// 다시 빌드하여 컴파일 오류를 방지해야 합니다.
  35. ///
  36. /// 솔루션 탐색기에서 대상 프로젝트를 마우스 오른쪽 단추로 클릭하고
  37. /// [참조 추가]->[프로젝트]를 차례로 클릭한 다음 이 프로젝트를 선택합니다.
  38. ///
  39. ///
  40. /// 2단계)
  41. /// 계속 진행하여 XAML 파일에서 컨트롤을 사용합니다.
  42. ///
  43. /// <MyNamespace:CustomControl1/>
  44. ///
  45. /// </summary>
  46. public class CustomControl1 : Control
  47. {
  48. static CustomControl1()
  49. {
  50. DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1)));
  51. }
  52. }
  53. }