新文章 网摘 文章 随笔 日记

WPF非主线程获取DataGrid的数据

//非主线程获取DataGrid的数据需要使用委托获取
                        Func<object> d = delegate () { return dgv.SelectedItem; };
                        MyClass selectedItem = Dispatcher.Invoke(d) as MyClass ;

 

posted @ 2023-05-02 14:49  岭南春  阅读(34)  评论(0)    收藏  举报