2014-09-07 3 views

답변

0

텍스트의 첫 번째 줄을 별도의 비활성화 된 컨트롤에 넣습니다.

0

내가 생각할 수있는 유일한 방법은 SelctionChanged 이벤트와 백 스페이스 keydown을 모니터링하는 것입니다. 이런 식으로 해보십시오.

private void textbox1_SelectionChanged(object sender, RoutedEventArgs e) 
    { 
     if (textbox1.GetLineIndexFromCharacterIndex(textbox1.SelectionStart) == 0) 
      textbox1.SelectionStart = textbox1.GetLineText(0).Length; 
    } 

    private void textbox1_PreviewKeyDown(object sender, KeyEventArgs e) 
    { 
     if (e.Key == Key.Back && textbox1.SelectionStart == textbox1.GetLineText(0).Length) 
      e.Handled = true; 
    } 
관련 문제