Answer the question
In order to leave comments, you need to log in
How to style DataTemplate for ListBox?
<ListBox
x:Name="audioView"
Width="380" Grid.Row="1"
Grid.ColumnSpan="3"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
SelectionMode="Extended"
>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock FontWeight="Bold" Text="{Binding artist}" Tag="{Binding url}" Tapped="TextBlock_Tapped"/>
<TextBlock Text=" – " />
<TextBlock Text="{Binding title}" Tag="{Binding url}" Tapped="TextBlock_Tapped" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text=" " />
Answer the question
In order to leave comments, you need to log in
1st option: Use Margin and Padding to achieve the desired effect.
2nd option: use xml:space="preserve" in the TextBlock where spaces need to be preserved.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question