0
我在將ListView綁定到List項目時收到COM異常。這裏的例外是從第二行中拋出。 「 'System.Runtime.InteropServices.COMException' 類型的第一次機會異常發生在APP.EXEComException,而XAML Metro應用程序中的數據綁定
附加信息:災難性故障(從HRESULT異常:0x8000FFFF(E_UNEXPECTED))」
Playlists = content.getPlayLists();
PlayListView.DataContext = Playlists;
XAML聲明綁定
<ListView x:Name="PlayListView" ItemsSource="{Binding ElementName=Playlists}" Background="AntiqueWhite" SelectionChanged="PlayListView_SelectionChanged" HorizontalAlignment="Left" Height="364" Margin="56,268,0,0" VerticalAlignment="Top" Width="308">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
我簡化了PlayList只有2個字符串,但仍然有同樣的問題。
public class PlayList
{
private string playListName;
private string description;
private DateTime dateTimeCreated;
private int numTracks;
private List<Track> tracks;
private string id;
public string Name
{
get { return playListName; }
set { playListName = value; }
}
public string Description
{
get { return description; }
set { description = value; }
}
public DateTime CreatedDate
{
get { return dateTimeCreated; }
set { dateTimeCreated = value; }
}
public int NumberOfTracks
{
get { return numTracks; }
set { numTracks = value; }
}
public List<Track> Tracks
{
get { return tracks; }
set { tracks = value; }
}
public String Id
{
get { return id; }
set { id = value; }
}
}
嗯,有些事情永遠不會改變,COM錯誤報告總是相當差。真正的災難。 – 2012-02-01 01:03:43