TextBlocks become white

Docking/MDI for WPF Forum

Posted 12 years ago by Kasper
Version: 11.2.0554
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hi guys,

Here's another one of those pesky problems that I know you won't appreciate :). Let me start off by saying that I have spent 1½ hour trying to reproduce the problem in another application, but without luck. I hope you can help me anyway.

The problem: TextBlock controls in ToolWindows gets a white Foreground property, making them invisible unless I manually change the Foreground property. I have checked this with Snoop, which tells me that the Foreground is indeed white and that the value is "inherited" - unfortunately I can't seem to get Snoop to tell me WHERE it's inherited from? However, if I go up the visual tree, the parent Panel has a TextElement.Foreground property set to white as well, but at the next parent (a ContentPresenter) the TextElement.Foreground is now black. 

Now this is definitely related to the Office themes somehow. I have these three lines in the start of my Window_Loaded:

ThemeManager.AreNativeThemesEnabled = true;
ThemesOfficeThemeCatalogRegistrar.Register();
ThemeManager.CurrentTheme = ThemeName.OfficeBlue.ToString();

 If I disable the second line, there's no problems (despite the lack of Office look, of course). 

I'm pretty sure that this is not caused by something I'm doing. I can't find anywhere in my code where I set the Foreground property, but just to make sure, I've tried disabling all my styles in App.xaml and in my Main window resources, as well as disabling pretty much all the start up code except for the lines above. No difference.

And as I was writing the above, I just realized that there is one minor difference in my sample app and my real app - I was doing the theme lines in the constructor in my sample app and in the Window_Loaded event in my real app. As it turns out, this made a difference in my sample app - moving the lines from the constructor to the Window_Loaded event allows me to reproduce the problem. However, and this is where it gets really, really great, moving the lines in my real app makes no difference - what the hell?? I then tried making an even simpler app, that doesn't mimic my current layout but simply has a Tool window, and there it doesn't matter where I put the code, it just works. 

As you can probably tell, I'm pretty confused right now. It's obviously related to (Office?) themes and tool windows in some strange combination, but how? I will send the sample app that I was able to make, despite my initial comment, to your support mail. I really hope it helps!

For the record, I can workaround this problem by manually setting the Foreground each time I use e.g. a TextBlock, but it's kinda annoying :)

Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thanks for the sample, we fixed the problem by adding a Foreground setter to DockingWindow.  This will be in the next maintenance release.


Actipro Software Support

Posted 12 years ago by Kasper
Avatar

That's awesome news! This problem was driving me a little bit crazy :)

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.