I would like to change the style of the first item in a listbox on startup. What method can I use to change this code for an other style for the first item only?
<ListBox x:Name="ListboxNieuws"
Width="408"
Margin="0,10,-12,0"
ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17"
Orientation="Horizontal"
Tap="StackPanel_Tap">
<!-- Replace rectangle with image -->
<Rectangle Width="100"
Height="100"
Margin="12,0,9,0">
<Rectangle.Fill>
<ImageBrush x:Name="plaatje" ImageSource="{Binding LineImg}" />
</Rectangle.Fill>
</Rectangle>
<StackPanel Width="311">
<TextBlock x:Name="title"
FontSize="30"
Text="{Binding LineOne}"
TextWrapping="Wrap" />
<Line Stretch="Fill"
Stroke="White"
X1="0"
X2="1"
Y1="0"
Y2="0" />
<TextBlock x:Name="time"
Margin="0,0,12,10"
Style="{StaticResource PhoneTextSubtleStyle}"
Text="{Binding LineTwo}" />
<Image Width="20"
Height="20"
Margin="-170,-45,0,0"
Source="/PostDateIcon.png" />
<TextBlock x:Name="date"
Margin="85,-37,12,10"
Style="{StaticResource PhoneTextSubtleStyle}"
Text="{Binding LineThree}" />
<TextBlock x:Name="content"
Text="{Binding LineContent}"
Visibility="Collapsed" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Hopefully one of you can help me to change this style.
Make use of the ItemTemplateSelector
to apply the template for your item based on your wish...
Have a look on the following link...