我的 xaml 中有一个列表视图,我想在代码隐藏中获取所选项目。事实上,我想获取项目的内容(这是一个对象)。我试过 MyListView.SelectedItems[0] 但它不起作用,我有“访问器获取或设置预期”。
我正在研究在DB中存储图像的应用程序.图像与一个对象有关,我必须使用Linq.当我在数据库中插入对象时,它的图像是System.Drawing.Image,需要在System.Data.Linq.Binary中进行转换.
我找到了另一种方式的tutos,但不是这个.
我知道这个问题已经得到解答但是尽管我付出了努力,我还是无法以编程方式关闭我的应用程序.我试过这个,这不起作用:
private void CloseAppCommand_Executed(object sender, ExecutedRoutedEventArgs e)
{
System.Windows.Forms.Application.Exit();
}
Run Code Online (Sandbox Code Playgroud)
这个(但Visual Studio 2010无法识别它):
Application.Current.Shutdown();
Run Code Online (Sandbox Code Playgroud)
有人知道为什么这些解决方案不起作用?我认为这可能是因为WPF和WinFOrms,但我不确定.