You're using the DataTemplate
property which affects databound data. From the screenshot it looks like you're in VS designer rather than actually running the application. In that case you can set the ItemContainerStyle
.
<ListBox>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<TextBlock Text="12233" Foreground="AliceBlue" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBoxItem>My ListBoxItem</ListBoxItem>
</ListBox>
If you're just testing the layout then your DataTemplate
should be fine and can be tested by setting a source for the ListBox
(such as via myListBox.ItemsSource
or data binding if have that set up).