locked
Bullet Points RRS feed

  • Question

  • How do I add Bullet Points in SilverLight 4.0?

     

    I tried the <ul> </ul> HTML code and it doesn't work. Is there a special code in SilverLight for Bullet Points?

     

     

    Tuesday, June 22, 2010 8:14 AM

All replies

  • Hi,

    You can try something like this:

    <ListBox x:Name="myListBox" VerticalAlignment="Stretch" Margin="5,2,2,2" Height="150"

    HorizontalAlignment="Stretch" Width="240" LocalModel:DiseaseTreatment.AddMouseWheelSupport="true">

    <ListBox.ItemTemplate>

    <DataTemplate>

    <StackPanel Orientation="Horizontal">

    <Image Source="bullet.png" VerticalAlignment="Center" Height="9" Width="7"></Image>

    <TextBlock x:Name="myTextBloxk" Margin="5,2,0,0" VerticalAlignment="Top" Text="{Binding Path=Name}"></TextBlock>

    </StackPanel>

    </DataTemplate>

    </ListBox.ItemTemplate>

    </ListBox>

    HTH Smile

    Tuesday, June 22, 2010 8:19 AM
  •  thanks Varshav for the swift reply, I appreciate it.

    Do I have to upload the image (bullet.png) somewhere for this to work?

     

    Tuesday, June 22, 2010 8:29 AM
  • Yes, You can create one folder named images or anything in your Silverlight Application and change the source path of it.

    Rest all will work fine, let me know if you have any issue.

    Tuesday, June 22, 2010 8:50 AM
  • You can use Richtext box to format the text the way you want.

    Tuesday, June 22, 2010 9:05 AM
  •  Should I write my text only inside the <text block> tags? </ text block>

     

    and how do I call the bullet? (by <img> tag?)

     

    Wednesday, June 23, 2010 2:14 AM
  • Yes, Textblock will have your text and image will have the bullet point which you want. If you just want * as Bullets then just add TextBlock instead of image and put its Text="*"

    HTH Smile

    Wednesday, June 23, 2010 2:18 AM
  • I get an error when I use the code. Maybe because I'm pulling the text from the DataBase (I forgot to mention that). My website takes the text from a mySQL database and present it in SilverLight 4.0.

     

    Wednesday, June 23, 2010 3:54 AM
  • You have to Bind your text with TextBlock. What error you are getting? Post your sample code.

    Wednesday, June 23, 2010 4:07 AM