2010-04-21 3 views
0

J'essaie d'autoriser un utilisateur à créer une table à l'intérieur d'un RichTextBox. Je peux créer une grille à l'intérieur de la RichTextBox, mais j'ai quelques problèmes avec celle-ci. Je commence avec ce XAML dans la grille.Comment accéder à une grille dans un RichTextBox dans Silverlight 4?

<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> 

Puis, quand je reçois le XAML à l'aide de la propriété XAML RichTextBox je reçois ce 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> 

Notez que la grille est devenue un élément Run vide.

Quelqu'un sait-il pourquoi cela se produit?

Répondre

0

Comme il s'avère que le RichTextBox.Xaml Property dans Silverlight 4 n'inclut pas les InlineUIElements. Il y a une note à ce sujet dans les documents.

Notez que la chaîne XAML renvoyée par la propriété Xaml n'inclura aucun objet UIElement présent dans le contenu. Les objets InlineUIContainer seront convertis en objets Run vides.

Questions connexes