1
我试图使用ListBox和ItemsSource属性显示来自YouTube的视频列表。在DataTemplate中使用名称空间DataType
我现在有什么作品(下),但现在我需要格式化我的数据。
<ListBox Name="lbVideos" ItemsSource="{Binding Source={StaticResource listOfVideos}}"/>
为此,我使用了DataTemplate,但问题在于该类型是Google.YouTube.Video。
<Application x:Class="YouTube_Notifier.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="AppStartup"
xmlns:src="clr-namespace:YouTube_Notifier"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<Application.Resources>
<DataTemplate DataType="{x:Type src:Google:YouTube:Video}">
</DataTemplate>
</Application.Resources>
</Application>
上述结果在我得到的错误代码“类型‘SRC:Google.YouTube.Video’没有被发现。”
我在问什么是如何在DataTemplate中使用名称空间?
那么这是不是更容易我想。谢谢! :-) – Dumpen