Solved

WPF "defaults"? - Display issues

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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