Latest News

  • Silverlight Online Chat
    Jul 24, 2010

    Today we launch the new Silverlight Live Chat application demonstrating the Liquid RichTextBox and Emoticon replacements.

  • New Super Shoot Em Up 2 Game
    Jun 29, 2010

    Added to the Games section is the new Super Shoot 'Em Up 2 game. Take control of your tank with the aim to defeat the computer controlled opponents. Features all new weapons, levels and Battle Mode!

  • Silverlight 4 Controls V5.3.2 Released
    Jun 28, 2010

    This release contains several fixes raised in the forums.

  • New Sandmania Puzzle Game
    Jun 18, 2010

    Sandmania is the latest game from vectorlight, the aim of this game is to guide sand from the top of the screen to the various colored containers below.

  • New Moon Tower Defense Game
    May 29, 2010

    Added to the Games section is the new Moon Tower Defense game. Defend the Moon from the circling Aliens and Humans.

PanzertaxNoruga
PanzertaxNoruga
chat control Posted: Mar 12, 2010
 

How can I add UIElements and make sure that the elements are created under each other?

Each time a button is clicked I add the following text

            TextBlock tb = new TextBlock();

            tb.Text = "The time is: ";

            tb.Foreground = new SolidColorBrush(Colors.Red);


            TextBlock tb1 = new TextBlock();

            tb1.Text = DateTime.Now.ToString()";

            tb1.Foreground = new SolidColorBrush(Colors.Black);


            rtb.InsertElement(rtb.Children.Count, tb);

            rtb.InsertElement(rtb.Children.Count, tb1);


            rtb.End();

            rtb.Bottom();


Now I want it to look like this


The time is 11:22:33

The time is 11:22:33

The time is 11:22:33

The time is 11:22:33


and not The time is 11:22:33 The time is 11:22:33 The time is 11:22:33 The time is 11:22:33


So i need a linebreak.. Also Im using vertical scroll so how can I make the richcontrol make the text at the bottom present?

I tried to set

     Scroll.ScrollToVerticalOffset(Double.MaxValue);

     Scroll.UpdateLayout();


In the button click event but since the text is inserted in this method I guess I have to set it in a event that is triggered. But I have not found this event. Like contentchanged is not affected by the  rtb.InsertElement(rtb.Children.Count, tb);


could anyone plz help me with this?

 
 
dan
dan
RE: chat control Posted: Mar 20, 2010
 

Hi,


Yes you can simply add a newline using the method:


richTextBox.InsertNewline();


Thanks!

 
 
PanzertaxNoruga
PanzertaxNoruga
RE: chat control Posted: Mar 20, 2010
 

Well this still doesnt work. Now I have in my usercontrol

        <Grid>

            <Grid.RowDefinitions>

                <RowDefinition Height="20" />

                <RowDefinition Height="200" />

                <RowDefinition />

            </Grid.RowDefinitions>


            <Button Content="CLICK" Click="Button_Click" Grid.Row="0"></Button>

            <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden" x:Name="Scroll">

                <liquidRichText:RichTextBox x:Name="rtb" VerticalScrollBarVisibility="Hidden"></liquidRichText:RichTextBox>

            </ScrollViewer>

        </Grid>


and in code

 int i = 0;

        private void Button_Click(object sender, RoutedEventArgs e)

        {

            TextBlock tb1 = new TextBlock();

            tb1.Text = DateTime.Now.ToString();

            tb1.Foreground = new SolidColorBrush(Colors.Black);



            rtb.InsertElement(rtb.Children.Count,tb1);

        

            rtb.InsertNewline();

            

            Scroll.ScrollToVerticalOffset(Double.MaxValue);


            Scroll.UpdateLayout();


        }

But still the text does not appear at the bottom?? I want like msn where the text appears on the bottom of the box.