How do you center align the items of a Listbox using C# in Windows 8?
Here is my xaml:
<ListBox x:Name="listBox1" HorizontalAlignment="Left" Height="365" Margin="242,275,-1,0" VerticalAlignment="Top" Width="190" SelectionChanged="listBox1_SelectionChanged" FontSize="20" FontWeight="Bold"/>
And in the code behind, I populate the listbox with the following code:
listBox1.Items.Add(new ListBoxItem() { Content = Global.availableDecks[0].ToString(), IsEnabled = true });
listBox1.Items.Add(new ListBoxItem() { Content = Global.availableDecks[1].ToString(), IsEnabled = true });
Try creating a ItemTemplate to create visual representations of your object (list box items in this case). You can find more information here