Solved

WPF "defaults"? - Display issues

Posted on 2014-01-16
3
442 Views
Last Modified: 2014-01-16
Hi there...

I designed a ListView using WPF, and - for example - for the selected Items I have a nice looking background gradient:

                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="ListBoxItem.IsSelected" Value="True"/>
                        </MultiTrigger.Conditions>
                        <Setter Property="Background">
                            <Setter.Value>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="1,0">
                                    <GradientStop Color="#FFFFD1FF" Offset="0.986"/>
                                    <GradientStop Color="#FFF8B2F8" Offset="0.5"/>
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                    </MultiTrigger>

However, when I run this application on a Windows Server Standard edition it reverts back to the standard look and feel for a ListView, so the selected item has black text on a dark blue background.

First of all... is there anything I can do to stop this? To make the listview behave the same across the board.

Failing that, can I change the "fallback" scheme for the ListView. So basically I'd be instructing the system to use the LinearGradientBrush IF IT CAN, but if not, then at least use a paler solid background brush instead?

Cheers


Pino
0
Comment
Question by:WernerVonBraun
  • 3
3 Comments
 
LVL 4

Accepted Solution

by:
WernerVonBraun earned 0 total points
ID: 39784910
Never mind. I found a solution. In the Window resources I add something like this:

 <Window.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                             Color="Red" />
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}"
                             Color="Blue" />
 </Window.Resources>

(obviously I'm not using blue text on a red background but I'm only illustrating the nature of the solution). On an OS that can handle it, my MultiTriggers override the system settings, but on something like Windows XP it at least falls back gracefully to something that is not entirely cack.
0
 
LVL 4

Author Comment

by:WernerVonBraun
ID: 39784913
BTW - I realised that the standard listview pattern is to have WHITE text on a dark blue background, but my GridColumn DataTemplates were using labels and they stayed happily black. Just to add to the confoozin...
0
 
LVL 4

Author Closing Comment

by:WernerVonBraun
ID: 39784915
Et voilá
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question