Selected ListBoxItem does not have a background of ControlBrushkey when app is unfocused - by mabster

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 750655 Comments
Status Closed Workarounds
Type Bug Repros 5
Opened 6/24/2012 3:09:44 PM
Access Restriction Public


In .NET 4 (even using VS2012 when targeting .NET 4), a ListBoxItem is rendered with a background of SystemColors.ControlBrush when it is selected but the app loses focus.

In .NET 4.5, selected ListBoxItems are rendered with a colour that looks like SystemColors.ControlBrush, but seems to be hard coded.
Sign in to post a comment.
Posted by StormENT on 8/29/2012 at 3:25 AM
FrameworkCompatibilityPreferences.AreInactiveSelectionHighlightBrushKeysSupported is only supported in 4.5 but I get the highlight colours targeting 4 running on win 8. Is there a way to turn off this behaviour when targeting 4?
Posted by elyohma on 8/24/2012 at 4:45 AM
This change should have been documented under the breaking changes between .Net 4 and .Net 4.5. One of WPF's core design principles is that you can restyle all the controls. What is the point of making all WPF applications look consistent with each other when a good number of them use custom styles anyway. All the investment in time and money for styling applications is wasted by an inexplicable "by design" decision. Now a custom a styled ListBoxItem or ComboBox looks even more out of place thanks to this flawed decsion.
Posted by Microsoft on 6/26/2012 at 4:02 PM
Also, the difference you're seeing between targeting 4.0 and 4.5 can be affected by a compatibility flag. If you set
FrameworkCompatibilityPreferences.AreInactiveSelectionHighlightBrushKeysSupported = false;

early on in your app (e.g. in MainWindow.ctor before calling InitializeComponent), you'll get the 4.0 behavior.
Posted by Microsoft on 6/26/2012 at 3:54 PM
The designers of the AeroLite and Aero2 themes (the new themes for Win8) chose new colors and appearance for the selection feedback in ListBox, rather than using system colors. Sadly, they did not do so in a way that allows you to override their choices. WPF must honor their colors, to be consistent with other Win8 applications.
Posted by Microsoft on 6/25/2012 at 5:13 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Microsoft Visual Studio Connect Support Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 6/24/2012 at 3:54 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(