create grid in richtext box

Hi can anybody have any idea about how to create grid or canvas in a richtext box programatically

thanx-prasanth



Answer this question

create grid in richtext box

  • Slim

    You would be using an InlineUIContainer/BlockUIContainer

    btw all embedded elements within the grid will be disabled.


  • Splinter Cell

    The equivalent markup generated in Expression Interactive Designer looks like this - the markup is only a way to describe a heirarchy of objects, so your code just needs to reflect this markup.

    <RichTextBox x:Name="RichTextBox">
    <FlowDocument>
    <Paragraph>
    <Grid Background="Red" Height="100" Width="100">
    </Grid>
    </Paragraph>
    </FlowDocument>
    </RichTextBox>

    Grid grid = new Grid();
    grid.Background =
    new SolidColorBrush(Colors.Red);
    grid.Height = 100;
    grid.Width = 100;
    this.RichTextBox.Document = new FlowDocument(new Paragraph(new InlineUIContainer(grid)));

    Thanks!



  • create grid in richtext box