Ticket Q433375
Visible to All Users

wpf theme problem

created 13 years ago

I have set theme in WPF
Window like so:

dx:ThemeManager.ThemeName="LightGray"

It works perfect at design
time but at run time the GridControl has default DevExpress theme.

Yesterday I have fixed this
problem by changing .NET version from default 4.5 to 4.0 but today the problem appeared
back again.

The same problem is in Visual Studio 2010.

Comments (3)
DevExpress Support Team 13 years ago

    Hi,
    Thank you for your inquiry. I am afraid I cannot reproduce the issue you described. Please review the attached screeencast. Would you please clarify how to reproduce this shortcoming?
    I am looking forward to your response.
    Thanks

      I have just found that the problem is only when I run application from Visual Studio but when I run it alone everything is ok. In this way it is not that bad I can live with that.

      DevExpress Support Team 13 years ago

        Thank you for your response.
        The behavior you described is really strange and we still cannot reproduce it locally. To help us better understand the situation, would you please provide us with a screencast illustrating exactly what is happening on your side? For instance, you can capture it using the free Jing tool from TechSmith.
        In addition, please specify the exact Visual Studio version you are using: please click the "Copy Info" button in the "About Microsoft Visual Studio" dialog, and post the resulting information here.
        I have also noticed that you are working with an outdated version of our products (according to the Build field of this report you are using v11.2.12). I suggest that you upgrade to v11.2.13, which we recently published, and check if this makes a difference at your end.

        Answers

        created 13 years ago (modified 13 years ago)

        Now the
        problem is even more strange. At design time in VS 2012 I have an error like
        the one below. I have made screenshots about my visual studio versions and
        views from design time and runtime. Also I'm uploading current project. The
        bellow error disappears when I remove dx:ThemeManager.ThemeName="LightGray"
        from MainWindow.
        Everything behaves
        exactly the same on other computers in my company.
        InvalidOperationException: Cannot set OverridesDefaultStyle property in the default Style.

        at System.Windows.StyleHelper.UpdateThemeStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldThemeStyle, Style newThemeStyle, Style& themeStyleCache)
        at System.Windows.FrameworkElement.OnThemeStyleChanged(DependencyObject d, Object oldValue, Object newValue)
        at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
        at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
        at System.Windows.FrameworkElement.OnThemeStyleKeyChanged(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 DevExpress.Xpf.Core.DependencyObjectWrapper.SetDefaultStyleKey(Object value)
        at DevExpress.Xpf.Core.ThemeManager.UpdateDefaultStyleKey(DependencyObjectWrapper wrapper, String themeName)
        at DevExpress.Xpf.Core.ThemeManager.TreeWalkerChanged(DependencyObject obj, 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.TreeWalkHelper.InvalidateTreeDependentProperty(TreeChangeInfo info, DependencyObject d, FrameworkObject& fo, DependencyProperty dp, FrameworkPropertyMetadata fMetadata, Style selfStyle, Style selfThemeStyle, ChildRecord& childRecord, Boolean isChildRecordValid, Boolean hasStyleChanged, Boolean isSelfInheritanceParent)
        at System.Windows.TreeWalkHelper.InvalidateTreeDependentProperties(TreeChangeInfo info, FrameworkElement fe, FrameworkContentElement fce, Style selfStyle, Style selfThemeStyle, ChildRecord& childRecord, Boolean isChildRecordValid, Boolean hasStyleChanged, Boolean isSelfInheritanceParent)
        at System.Windows.FrameworkElement.InvalidateTreeDependentProperties(TreeChangeInfo parentTreeState, Boolean isSelfInheritanceParent)
        at System.Windows.FrameworkElement.OnAncestorChangedInternal(TreeChangeInfo parentTreeState)
        at System.Windows.TreeWalkHelper.OnAncestorChanged(DependencyObject d, TreeChangeInfo info, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
        at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
        at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
        at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
        at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
        at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
        at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
        at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
        at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
        at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
        at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
        at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
        at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
        at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
        at MS.Internal.PrePostDescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
        at System.Windows.TreeWalkHelper.InvalidateOnTreeChange(FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, Boolean isAddOperation)
        at System.Windows.FrameworkElement.OnVisualParentChanged(DependencyObject oldParent)
        at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
        at System.Windows.Media.Visual.AddVisualChild(Visual child)
        at System.Windows.Media.VisualCollection.ConnectChild(Int32 index, Visual value)
        at System.Windows.Media.VisualCollection.Add(Visual visual)
        at System.Windows.Controls.UIElementCollection.AddInternal(UIElement element)
        at System.Windows.Controls.Panel.GenerateChildren()
        at System.Windows.Controls.Panel.OnItemsChangedInternal(Object sender, ItemsChangedEventArgs args)
        at System.Windows.Controls.Panel.OnItemsChanged(Object sender, ItemsChangedEventArgs args)
        at System.Windows.Controls.ItemContainerGenerator.OnRefresh()
        at System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
        at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
        at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
        at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
        at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
        at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
        at System.Windows.Controls.ItemCollection.OnViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
        at System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
        at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
        at System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
        at System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
        at System.Windows.Data.ListCollectionView.RefreshOverride()
        at System.Windows.Data.CollectionView.RefreshInternal()
        at System.Windows.Data.CollectionView.Refresh()
        at System.Windows.Data.CollectionView.EndDefer()
        at System.Windows.Data.CollectionView.DeferHelper.Dispose()
        at System.Windows.Controls.ItemCollection.SetCollectionView(CollectionView view)
        at System.Windows.Controls.ItemCollection.SetItemsSource(IEnumerable value, Func`2 GetSourceItem)
        at System.Windows.Controls.ItemsControl.OnItemsSourceChanged(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.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
        at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
        at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
        at System.Windows.Data.BindingExpression.Activate(Object item)
        at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
        at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
        at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
        at MS.Internal.Data.DataBindEngine.Run(Object arg)
        at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
        at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
        at System.Windows.ContextLayoutManager.UpdateLayout()
        at System.Windows.UIElement.UpdateLayout()

          Show previous comments (2)
          Alexander E (DevExpress) 13 years ago

            Hi,
            Thank you for your inquiry. I have researched your sample and found a strange thing in the references' definition. I think it may be the cause of the problem. I have re-added all references to our libraries and the project works correctly at design time. I have attached a video to demonstrate this. Please try this approach and let me know of your results.

              Hello,
              Today I was having same behavior with 13.2.8 version. Removing the line of code "dx:ThemeManager.ThemeName="LightGray"" causes a cyclical exception with TextEdit control, related to theme process. Really annonaying this issue.
              I have a question here: If you remove this line of code, why is not placed again when a new theme is selected ???. Seems that app.config is affected too. Removing the lines in the .config file related to DevExpress theme management, causes exceptions too.
              See attached image.
              Thank you.
              César Qüeb

              DevExpress Support Team 11 years ago

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.