locked
Add strings & controls into Rich TextBlock. RRS feed

  • Question

  • Hi,

    I am still the beginner for windows store apps.

    Can anyone please tell me how to add-in the simple "strings & controls" into the Rich TextBlock.

    In previous visual studio versions, I used to add like this
         .....
         rich_textbox1.Text="string1";
         rich_texbox1.Controls.Add(button1);
         ....

    Please someone advise me how to write this while building windows store apps.

    Thanks in advance.

    Wednesday, December 19, 2012 2:15 PM

Answers

  • Hi,

    You would use code similar to the following to accomplish this:

    <RichTextBox HorizontalAlignment="Left" Height="100" Margin="141,97,0,0" VerticalAlignment="Top" Width="100">
                <FlowDocument>
                    <Paragraph>
                        <Run Text="String 1"/>
                        <Button Name="test">Click me</Button>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>

    Best Regards,

    Jimmie

    Wednesday, December 19, 2012 4:34 PM