I know i have made some silly mistake. But won't able to solve.
This is the xaml code:
<Border BorderBrush="Red" BorderThickness="3" Grid.Column="0" Grid.Row="0">
<toolKit:ListBoxDragDropTarget AllowDrop="True" >
<ListBox Height="85" Width="120">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="12233" Foreground="AliceBlue"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</toolKit:ListBoxDragDropTarget>
</Border>
And the screen shot is :
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).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.