Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1240
Exception when setting the Theme
posted

On occasion, when I set the theme in code behind, I get an exception with the message "The calling thread cannot access this object because a different thread owns it."

 

Here is the call stack:

 

   at System.Windows.Threading.Dispatcher.VerifyAccess()

   at System.Windows.Threading.DispatcherObject.VerifyAccess()

   at System.Windows.Style.CheckTargetType(Object element)

   at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)

   at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)

   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)

   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)

   at Infragistics.Windows.DataPresenter.GroupByAreaFieldLabel.SetStyle(Style defaultStyle)

   at Infragistics.Windows.DataPresenter.GroupByArea.CreateGroupByAreaFieldLabelFromField(Field field, Style defaultStyle, Boolean forGroupedFieldsArea)

   at Infragistics.Windows.DataPresenter.GroupByArea.RefreshAvailableFieldLabels(FieldLayout fieldLayout, GroupByAreaFieldLabelCollection availableFieldLabels, Boolean notifyCollectionChanged)

   at Infragistics.Windows.DataPresenter.GroupByArea.OnThemeChanged(Object sender, RoutedPropertyChangedEventArgs`1 e)

   at System.Windows.RoutedPropertyChangedEventArgs`1.InvokeEventHandler(Delegate genericHandler, Object genericTarget)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)

   at Infragistics.Windows.DataPresenter.DataPresenterBase.RaiseEventHelper(RoutedEventArgs args)

   at Infragistics.Windows.DataPresenter.DataPresenterBase.OnThemeChanged(String previousValue, String currentValue)

   at Infragistics.Windows.DataPresenter.DataPresenterBase.OnThemeChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)

   at System.Windows.PropertyChangedCallback.Invoke(DependencyObject d, DependencyPropertyChangedEventArgs e)

   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at Infragistics.Windows.DataPresenter.DataPresenterBase.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at Infragistics.Windows.DataPresenter.XamDataGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)

   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)

   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)

   at Infragistics.Windows.DataPresenter.DataPresenterBase.set_Theme(String value)

 

 

It does not happen every time I set the theme, but since it’s deep inside of the data grid’s code, I can’t figure out the cause or solution.

Any ideas?

 

Thanks

Dan

Parents Reply Children
No Data