728x90
반응형
728x170
using System.Windows;
#region 부적절한 IInputElement 객체 찾기 - FindInvalidInputElement(parentDependencyObject)
/// <summary>
/// 부적절한 IInputElement 객체 찾기
/// </summary>
/// <param name="parentDependencyObject">부모 DependencyObject 객체</param>
/// <returns>부적절한 입력 엘리먼트 객체</returns>
/// <remarks>ValidationRule 객체를 설정한 IInputElement 객체 중에서 에러를 갖는 객체를 찾는다.</remarks>
private IInputElement FindInvalidInputElement(DependencyObject parentDependencyObject)
{
if(parentDependencyObject == null)
{
return null;
}
if(parentDependencyObject is IInputElement)
{
if(Validation.GetHasError(parentDependencyObject))
{
return parentDependencyObject as IInputElement;
}
}
foreach(object childObject in LogicalTreeHelper.GetChildren(parentDependencyObject))
{
if(childObject is DependencyObject)
{
IInputElement invalidInputElement = FindInvalidInputElement(childObject as DependencyObject);
if(invalidInputElement != null)
{
return invalidInputElement;
}
}
}
return null;
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] SaveFileDialog 클래스 : 파일 저장 대화 상자 보여주기 (0) | 2014.01.29 |
---|---|
[C#/WPF] OpenFileDialog 클래스 : 이미지 파일 열기 대화 상자 보여주기 (0) | 2014.01.29 |
[C#/WPF] OpenFileDialog 클래스 : 파일 열기 대화 상자 보여주기 (0) | 2014.01.29 |
[C#/WPF] Window 클래스 : 투명 윈도우 만들기 (0) | 2014.01.28 |
[C#/WPF] ValidationRule 클래스 사용하기 (0) | 2014.01.28 |
[C#/WPF] LogicalTreeHelper 클래스 : 부적절한 IInputElement 객체 찾기 (0) | 2014.01.28 |
[C#/WPF] TextBox 엘리먼트 : 스타일을 사용해 검증 에러 발생시 에러 내용을 Tooltip 속성에 설정하기 (0) | 2014.01.28 |
[C#/WPF] Button 엘리먼트 : IsCancel 속성을 사용해 디폴트 취소 버튼 설정하기 (0) | 2014.01.28 |
[C#/WPF] Button 엘리먼트 : IsDefault 속성을 사용해 디폴트 확인 버튼 설정하기 (0) | 2014.01.28 |
[C#/WPF] MessageBox 클래스 사용하기 (0) | 2014.01.28 |
[C#/WPF] TextBox 엘리먼트 : AcceptTab 속성을 사용해 Tab 키 입력 가능하게 하기 (0) | 2014.01.28 |
댓글을 달아 주세요