我的 ListBox 有这个 XAML:
<ListBox x:Name="LbBatidas" ItemsSource="{Binding Batidas}" Height="Auto" Grid.Row="3" Grid.ColumnSpan="2">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="72">
<Image Source="{Binding Natureza, Converter={StaticResource NaturezaBatidaConverter}}" Width="72"/>
<TextBlock Text="{Binding Horario, StringFormat=\{0:HH:mm:ss\}}" VerticalAlignment="Center" FontSize="48" Margin="10,0,0,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
但是当我运行我的应用程序时,它完全正常。
如果我删除图像源绑定的转换器无效 XAML 停止的错误
<ListBox x:Name="LbBatidas" ItemsSource="{Binding Batidas}" Height="Auto" Grid.Row="3" Grid.ColumnSpan="2">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="72">
<Image Source="{Binding Natureza}" Width="72"/>
<TextBlock Text="{Binding Horario, StringFormat=\{0:HH:mm:ss\}}" VerticalAlignment="Center" FontSize="48" Margin="10,0,0,0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>