Windows 7 Mobile ListBox uncustomizable?
Posted
by Roy
on Stack Overflow
See other posts from Stack Overflow
or by Roy
Published on 2010-06-07T21:35:42Z
Indexed on
2010/06/07
21:52 UTC
Read the original article
Hit count: 215
windows-mobile
|windows-phone-7
I've just recently started development using Visual Studio 2010 Express for Windows Phone and I put in a ListBox. I can't seem to manipulate the formatting. No matter what I do, the background is black/gray, the selected items have a blue border, and there is padding between the items in the listbox (i'm using images). Here is my code:
Xaml:
<Grid x:Name="ContentGrid" Grid.Row="1">
<Grid Name="gallery">
<Grid.RowDefinitions>
<RowDefinition Height="370" />
<RowDefinition Height="150" />
</Grid.RowDefinitions>
<Border BorderBrush="Red" Width="450" CornerRadius="4" BorderThickness="2"
Background="Red" Margin="10,30,20,10" Padding="6,6,6,6">
<Image Grid.Row="0" Grid.Column="0" Height="360" x:Name="imgPreview"/>
</Border>
<ListBox x:Name="lbScrollGallery" Grid.Row="1" Grid.Column="0" Padding="0"
VerticalAlignment="Top" Width="450" SelectionChanged="ScrollerSelectionChanged"
d:LayoutOverrides="HorizontalAlignment" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Image Width="100" Height="100" Stretch="Fill" Name="imgSource"
VerticalAlignment="Center"
Source="{Binding Path=Url}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
Is there some way I can customize the listbox? Like change the background to red or make the padding between different items 0?
© Stack Overflow or respective owner