2012-09-03 3 views
-1

UserControl MyTextBox : System.Windows.Controls.TextBox을 만들었습니다. 사용자 지정 validationRules를 Databinding에 추가했으며 XAML에서 Validation.Error 이벤트를 정의했습니다.루트 (UserControl)에서 TextBox Validation.Error 이벤트를 정의하십시오.

Validation.Error 이벤트를 루트 (MyTextBox)로 옮겨서 일반적으로 처리 할 수 ​​있습니다. Usercontrol에서 이러한 메서드를 구현할 수 없습니다.

아무도 도와 줄 수 있습니까?

답변

0

제 질문에 대한 답변을 얻었습니다. 로드 이벤트시 구현은 다음과 같습니다.

//Check whether Designer mode is open. If not then set Custom binding 
if ((bool)(DesignerProperties.IsInDesignModeProperty.GetMetadata(typeof(DependencyObject)).DefaultValue) == false) 
     { 
      SetBinding(); 
     } 
관련 문제