windows-phone-7 – ‘VisualTree’设置不止一次

前端之家收集整理的这篇文章主要介绍了windows-phone-7 – ‘VisualTree’设置不止一次前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在这个xaml文件中收到错误

The property ‘VisualTree’ is set more than once.

<ListBox x:Name="lstHistory" HorizontalAlignment="Left" Margin="12,284,90" Width="460"
                 ItemsSource="{Binding
                                Source={StaticResource SongCollection},Path=DataCollection}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Margin="5" VerticalAlignment="top" Source="{Binding Path=Image}" />
                    </StackPanel>
                    <TextBlock Margin="8" Width="250"
                  TextWrapping="Wrap"
                  VerticalAlignment="Top"
                  HorizontalAlignment="Left"
                  Text="{Binding Path=Name}" />
                    <TextBlock Width="100"
                  Margin="8,8,8"
                  VerticalAlignment="Top"
                  HorizontalAlignment="Left"
                  Text="{Binding Path=Artist}" />
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>

谁能帮忙?

@H_404_10@
DataTemplate只能有1个小孩.你有2(stackpanel和textblock).将其包装在单个容器中,一切都会很好

猜你在找的Windows相关文章