Hi,
I have a myRadGridView binded to a QueryableEntityCollectionView<tableName> property. All worked perfect.
But when I create a Task to fill that property (that was binded to my RadGridView) it appears a messaje saying:
Ocurrió System.InvalidOperationException
HResult=-2146233079
Message=El subproceso que realiza la llamada no puede obtener acceso a este objeto porque el propietario es otro subproceso.
Source=WindowsBase
StackTrace:
en System.Windows.DependencyObject.GetValue(DependencyProperty dp)
en Telerik.Windows.Data.SortDescriptor.get_Member() en c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Data\Sorting\SortDescriptor.cs:línea 22
InnerException:
I'm using a MVVM pattern.
The definition of my property binded to my RadGridView is:
The code I have written in the ViewModel is:
 
The RadGridView is:
In the ViewModel, if I change the definition of the property and the code of the Task for the next one code, it works:
So, my question is:
How can I use QueryableEntityCollectionView<tableName> in a Task?
Thanks.
Sonia.
                                I have a myRadGridView binded to a QueryableEntityCollectionView<tableName> property. All worked perfect.
But when I create a Task to fill that property (that was binded to my RadGridView) it appears a messaje saying:
Ocurrió System.InvalidOperationException
HResult=-2146233079
Message=El subproceso que realiza la llamada no puede obtener acceso a este objeto porque el propietario es otro subproceso.
Source=WindowsBase
StackTrace:
en System.Windows.DependencyObject.GetValue(DependencyProperty dp)
en Telerik.Windows.Data.SortDescriptor.get_Member() en c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Data\Sorting\SortDescriptor.cs:línea 22
InnerException:
I'm using a MVVM pattern.
The definition of my property binded to my RadGridView is:
private QueryableEntityCollectionView<PROTOCOL> protocolsView;public QueryableEntityCollectionView<PROTOCOL> ProtocolsView{    get { return protocolsView; }    set    {        protocolsView = value;        RaisePropertyChanged("ProtocolsView");    }}Task.Factory.StartNew(new Action(() =>            {                DbContext dbContext = new wafintellectEntities(Global.Configuracion.CadenaConexionBDEntity); // connection to BD                ObjectContext objectContext = ((System.Data.Entity.Infrastructure.IObjectContextAdapter)dbContext).ObjectContext;                bool error = false;                try                {                    //ProtocolsView = new QueryableEntityCollectionView<PROTOCOL>(objectContext, "PROTOCOLs");                    results = new QueryableEntityCollectionView<PROTOCOL>(objectContext, "PROTOCOLs");                }                catch (Exception e)                {                    error = true;                    MessageBox.Show("Cadena de conexión errónea. Por favor, configure la conexión con la BD correctamente." + System.Environment.NewLine + e.Message, "Imposible cargar datos", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);                }                mi.Invoke(new Action(() =>                {                    if (!error)                    {                        ProtocolsView = results; // "ProtocolsView " is the property binded to my RadGridView                    }                }));
		}));The RadGridView is:
<telerik:RadGridView    x:Name="grdProtocol"    ItemsSource="{Binding ProtocolsView}"    AutoGenerateColumns="False"    SelectionUnit="FullRow"    GridLinesVisibility="Horizontal"    CanUserDeleteRows="False"    CanUserInsertRows="False"    CanUserFreezeColumns="False"    RowIndicatorVisibility="Collapsed"    IsReadOnly="True"    ShowGroupPanel="False" Grid.ColumnSpan="2"></telerik:RadGridView>In the ViewModel, if I change the definition of the property and the code of the Task for the next one code, it works:
private IQueryable protocolsView;        public IQueryable ProtocolsView        {            get { return protocolsView; }            set            {                protocolsView = value;                RaisePropertyChanged("ProtocolsView");            }        }Task.Factory.StartNew(new Action(() =>            {                try                {                    wafintellectEntities myEntity = new wafintellectEntities(Global.Configuracion.CadenaConexionBDEntity); // connection to BD                    ProtocolsView = myEntity.PROTOCOLs; // get the entire data of the table PROTOCOLs                }                catch                {                    MessageBox.Show("Error al abrir BD...");                }            }));So, my question is:
How can I use QueryableEntityCollectionView<tableName> in a Task?
Thanks.
Sonia.