Solved

WPF "defaults"? - Display issues

Posted on 2014-01-16
3
440 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

932 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now