【发布时间】:2014-06-25 18:02:11
【问题描述】:
我有一个简单的 XAML 页面:
<Grid>
<Grid Margin="50">
<TextBlock Text="{Binding NowPlaying.tracktitle}" Foreground="White" FontSize="40"/>
<TextBlock Foreground="#dcdcdc" FontSize="20" Margin="0,50,0,0">
<Run Text="{Binding NowPlaying.artist}"/>
<Run Text=" - "/>
<Run Text="{Binding NowPlaying.album}"/>
</TextBlock>
</Grid>
</Grid>
页面代码如下所示:
public sealed partial class test : Page
{
// artistdata
public now_playing NowPlaying { get { return App.nowplaying; } }
public test()
{
this.InitializeComponent();
this.DataContext = this;
}
}
每当 App.nowplaying 中的属性发生更改时,该类都会触发 notifychanged 事件。当 XAML 收到此消息时,我的应用程序崩溃并出现错误:
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in SYSTEM.NI.DLL
有人知道我该如何解决这个问题吗?
【问题讨论】:
标签: c# windows-phone-8 data-binding binding windows-phone-8.1