Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a bulleted list in Windows Phone 8?

I just need a simple list of items with bullets preceding them. How can I do this? I can't find any control that does this I can use grids and such to accomplish this, but it seems like so much work for something so simple

like image 441
erotavlas Avatar asked Dec 04 '22 06:12

erotavlas


2 Answers

Just insert the bullet character directly into your XAML:

<StackPanel>
    <TextBlock Text="• Item 1"/>
    <TextBlock Text="• Item 2"/>
</StackPanel>

You can also use the Hex HTML entity:

<TextBlock>&#x2022; Item 1</TextBlock>

If the items come from a viewmodel / binding, then use an ItemsControl:

<ItemsControl ItemsSource="{Binding MyItems}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding StringFormat='• {0}'}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

Footnote: Not relevant to Silverlight/Windows Phone, but WPF has BulletDecorator - example.

like image 117
McGarnagle Avatar answered Jan 09 '23 15:01

McGarnagle


I used a stackpanel with bulletdecorators to show a bullet list:

<StackPanel>
  <BulletDecorator>
    <BulletDecorator.Bullet>
      <Rectangle Width="5" Height="5" Fill="Gray" />
    </BulletDecorator.Bullet>
    <TextBlock Margin="20,0,0,0">Step 1: test</TextBlock>
  </BulletDecorator>
  <BulletDecorator>
    <BulletDecorator.Bullet>
      <Rectangle Width="5" Height="5" Fill="Gray" />
    </BulletDecorator.Bullet>
    <TextBlock Margin="20,0,0,0">Step 2: test</TextBlock>
  </BulletDecorator>
</StackPanel>
like image 38
juFo Avatar answered Jan 09 '23 14:01

juFo