gpt4 book ai didi

windows-phone-7 - 'VisualTree' 设置不止一次

转载 作者:行者123 更新时间:2023-12-03 21:26:13 26 4
gpt4 key购买 nike

我在此 xaml 文件中不断收到错误消息:

The property 'VisualTree' is set more than once.


<ListBox x:Name="lstHistory" HorizontalAlignment="Left" Margin="12,284,0,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,0,8,8"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Text="{Binding Path=Artist}" />
</DataTemplate>
</ListBox.ItemTemplate>

</ListBox>

任何人都可以提供帮助?

最佳答案

DataTemplate 只能有 1 个 child 。你有 2 个(堆栈面板和文本块)。把它们包在一个容器里,一切都会好起来的

关于windows-phone-7 - 'VisualTree' 设置不止一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10621454/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com