2013-03-18 23 views
3

可能有人請解釋爲什麼我下面的代碼不起作用FlowDocumentScrollViewer字號不改變的FlowDocument內容字號

<UserControl x:Class="FlowDocReader.FlowDocumentScrollViewerIssues" 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"> 

     <FlowDocumentScrollViewer FontSize="56"> 
      <FlowDocument> 
       <Paragraph> 
        this text should be FontSize 56 
       </Paragraph> 
      </FlowDocument> 
     </FlowDocumentScrollViewer> 

</UserControl> 

正如你所看到的FontSize不是56,我想不出有什麼錯

回答

2

喜後,我在同樣的問題再次我能工作了這一點

運行

您可以在使用的風格,但簡單的改變只有在字號不是固定

都不行

<FlowDocumentScrollViewer FontSize="56"> 
     <Style TargetType="{x:Type FlowDocument}"> 
      <Setter Property="FontSize" Value="56"/> 
     </Style> 
     <FlowDocument FontSize="56"> 
      <Paragraph> 
       this text should be FontSize 56 
      </Paragraph> 
     </FlowDocument> 
    </FlowDocumentScrollViewer> 

將工作

<FlowDocumentScrollViewer FontSize="56"> 
     <Style TargetType="{x:Type FlowDocument}"> 
      <Setter Property="FontSize" Value="56"/> 
     </Style> 
     <FlowDocument> 
      <Paragraph> 
       this text should be FontSize 56 
      </Paragraph> 
     </FlowDocument> 
    </FlowDocumentScrollViewer> 
0

藉此:

 <FlowDocumentScrollViewer > 
      <FlowDocument FontSize="50"> 
       <Paragraph> 
        this text should be FontSize 56 
       </Paragraph> 
      </FlowDocument> 
     </FlowDocumentScrollViewer> 
+0

THX我知道這個,但通常我的代碼也應該工作,因爲'FontWeight'的作品例如 – WiiMaxx 2013-03-19 07:22:56

相關問題