2010-04-21 12 views
0

사용자가 RichTextBox 내부에서 테이블을 만들 수있게하려고합니다. RichTextBox 안에 그리드를 만들 수 있지만 그걸로 몇 가지 문제가 있습니다.Silverlight 4에서 RichTextBox 내부의 표에 액세스하는 방법은 무엇입니까?

그리드에서이 XAML부터 시작합니다.

<RichTextBox Name="TB1" AcceptsReturn="True"> 
    <Paragraph TextAlignment="Center"> 
     Hi everybody 
    </Paragraph> 
    <Paragraph> 
     <InlineUIContainer> 
      <Grid Background="Black"> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="10" /> 
        <RowDefinition Height="10" /> 
       </Grid.RowDefinitions> 
       <Grid.ColumnDefinitions> 
        <ColumnDefinition Width="10" /> 
        <ColumnDefinition Width="10" /> 
       </Grid.ColumnDefinitions> 
      </Grid> 
     </InlineUIContainer> 
    </Paragraph> 
    <Paragraph> 
     How are you today? 
    </Paragraph> 
</RichTextBox> 

그런 다음 RichTextBox의 Xaml 속성을 사용하여 XAML을 꺼내면이 XAML을 얻습니다.

<Section xml:space="preserve" HasTrailingParagraphBreakOnPaste="False" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> 

<Paragraph FontSize="11" FontFamily="Portable User Interface" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" TextAlignment="Center"> 
<Run Text="Hi everybody" /> 
</Paragraph> 

<Paragraph FontSize="11" FontFamily="Portable User Interface" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" TextAlignment="Left"> 
<Run /> 
</Paragraph> 

<Paragraph FontSize="11" FontFamily="Portable User Interface" Foreground="#FF000000" FontWeight="Normal" FontStyle="Normal" FontStretch="Normal" TextAlignment="Left"> 
<Run Text="How are you today?" /> 
</Paragraph> 
</Section> 

여기서는 Grid가 빈 Run 요소로 변했습니다.

왜 이런 일이 발생하는지 알고 계십니까?

답변

0

Silverlight 4의 RichTextBox.Xaml Property에는 InlineUIElements가 포함되어 있지 않습니다. 문서에 그것에 대한 메모가 있습니다.

Xaml 속성에서 반환 한 XAML 문자열에는 콘텐츠에있는 UIElement 개체가 포함되지 않습니다. InlineUIContainer 객체는 빈 Run 객체로 변환됩니다.

관련 문제