本文介绍了Silverlight背景工作者-无效的ThreadAccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道要为Dowork流程访问哪个线程:
我在DomainDataSource LoadedData中有以下代码
I don''t know which thread to access for the Dowork process:
I have the following code in the DomainDataSource LoadedData
<pre lang="vb">If (DataGrid.ItemsSource IsNot Nothing) Then
Dim count As Integer = DataGrid.ItemsSource.OfType(Of Object)().Count()
lblCount_Stat.Content = "Count: " & count
End If
尝试在加载数据网格时尝试访问无效的线程访问
I get an Invalid Thread Access when I try to access the datagrid as it is loading
<pre lang="vb">Private Sub BackgroundWorker_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs) Handles BackgroundWorker.DoWork
Dim result As String
result = Me.DataGrid.ItemsSource.OfType(Of Object)().Count()
e.Result = result
End Sub
推荐答案
这篇关于Silverlight背景工作者-无效的ThreadAccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!