2010-04-19 4 views

답변

4

불행히도 텍스트 상자 일 뿐이므로 상업용 WPF/Silverlight 서식있는 텍스트 상자에서 얻을 수있는 툴바와 같은 컨트롤 모음이 아닙니다.

당신은 형식 코드 as shown here까지 당신의 버튼을 묶어 :

//Set Bold formatting to selected content 
private void BtnBold_Click(object sender, RoutedEventArgs e) 
{ 
    object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty); 
    if (o.ToString() != "Bold") 
     MyRTB.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold); 


} 
//<SnippetItalic> 
//Set Italic formatting to selected content 
private void BtnItalic_Click(object sender, RoutedEventArgs e) 
{ 
    object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty); 
    if (o.ToString() != "Italic") 
     MyRTB.Selection.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Italic); 


} 

//Set Underline formatting to selected content 
private void BtnUnderline_Click(object sender, RoutedEventArgs e) 
{ 
    object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty); 
    if (o.ToString() != "Underline") 
     MyRTB.Selection.ApplyPropertyValue(TextElement.TextDecorationsProperty, TextDecorations.Underline); 
} 
+0

체크 아웃 이 컨트롤로 완료하십시오. http://wintoolbar.codeplex.com/ – ahmedsafan86

관련 문제