问题
I am developing windows phone application. here I am taking some images from Facebook.All images coming in horizontal scrolling one after other
Problem: how to add some blank space between two images
This is my code so far:
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel
Orientation="Horizontal"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Visible" >
<Image Source="{Binding Path=picture}" Width="250" Height="250" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
回答1:
Here is the solution set Margin Of Image control inside datatemplate of listbox.
<ListBox Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Auto">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding FacebookImages}" Stretch = "Fill" Margin="20,0,0,0"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
来源:https://stackoverflow.com/questions/20701567/display-images-from-facebook-in-separate-thumbnails