2013-05-21 149 views
1

如果我嘗試設置字體大小,Rich編輯框會崩潰。RichEditBox在某些情況下崩潰。

C#代碼:

REB_Value.Document.SetText(TextSetOptions.None, "Company Name, \nStreet name with zip code. \n123-456-7890"); 

的XAML:

<StackPanel Orientation="Vertical"> 
     <TextBlock Text="Lable for this Field:" Style="{StaticResource TextBlockStyle}"/> 
     <RichEditBox Name="REB_Value"    
        ContextMenuOpening="OnContextMenuOpening" 
        Style="{StaticResource MyStyle}" 
        SelectionChanged="OnSelectionChanged" > 
     </RichEditBox> 
</StackPanel> 

風格:

<Style x:Key="MyStyle" TargetType="RichEditBox"> 
     ... 
     <Setter Property="BorderBrush" Value="Transparent"/> 
     <Setter Property="BorderThickness" Value="{StaticResource TextControlBorderThemeThickness}"/> 
     <Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/> 
     <Setter Property="FontSize" Value="14"/> 
     ... 
    </Style> 

頁面呈現/負載如果我刪除屬性<Setter Property="FontSize" Value="14"/>或者如果我把一個/ n在我的字符串末尾 ie:"Company Name, \nStreet name with zip code. \n123-456-7890\n"

還有其他RichEditBoxes工作正常, 如:

SomeOtherREB.Document.SetText(TextSetOptions.None, "123456789"); 

我不明白爲什麼會這樣?

回答