RadComboBox- Invalid cross-thread access.

1 posts, 0 answers
  1. Mario
    Mario avatar
    8 posts
    Member since:
    Sep 2011

    Posted 14 Nov 2011 Link to this post

    Hello all,

    I have one RadComboBox in my screen and I load the items from one table using one query in my screen:

    private void Servicos_Loaded(object sender, RoutedEventArgs e)
                var objDataContext = (IContentItem)this.DataContext;
                var Screen = (Microsoft.LightSwitch.Client.IScreenObject)objDataContext.Screen;
                Screen.Details.Dispatcher.BeginInvoke(() =>
                    var serviceResources = (Screen as EditableScheduleViewApptsGrid).ServiceToAppointment.ToList();
                    this.actualServiceToAppt = serviceResources;
                    foreach (SERVICE iten in serviceResources)
                        RadComboBoxItem newItemServ = new RadComboBoxItem();
                        newItemServ.Content= iten.Name;

    When I create the RadComboBoxItem,




    newItemServ = new RadComboBoxItem();


     I get the error:
    UnauthorizedAccessException was unhandled by user code
    Invalid cross-thread access.

    What I'm doing wrong???
    How can I use Databind to put the data from the table (query) to the control RadComboBox??

Back to Top