wpf - How do I use the correct Windows system colors? -


i want use xaml style wpf button "mixer" , "change date , time settings..." text of these windows 7 notification area flyouts.

does property of systemcolors define color? which?

<setter property="foreground"         value="{dynamicresource {x:static systemcolors.????}}" /> 

windows 7 notification area flyout

the best method i've found experimentation , guessing.

i created little utility visualize these colors.

interface

system.windows.systemcolors

xaml

<window x:class="systemcolors1.mainwindow"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     title="system.windows.systemcolors" height="350" width="525">     <window.resources>         <datatemplate x:key="cellcolor">             <dockpanel>                 <textblock>                     <textblock.background>                         <solidcolorbrush color="{binding path=color}" />                     </textblock.background>                     <textblock.text>                          &#160;&#160;&#160;&#160;&#160;                         &#160;&#160;&#160;&#160;&#160;                         &#160;&#160;&#160;&#160;&#160;                     </textblock.text>                 </textblock>             </dockpanel>         </datatemplate>     </window.resources>     <grid>         <listview grid.row="1"                   name="systemcolorslist"                   itemssource="{binding}">             <listview.view>                 <gridview allowscolumnreorder="true">                     <gridviewcolumn celltemplate="{staticresource cellcolor}"                                     header="color"                                     width="auto"/>                     <gridviewcolumn displaymemberbinding="{binding path=name}"                                     header="name"                                     width="auto"/>                 </gridview>             </listview.view>         </listview>     </grid> </window> 

c#

using system.collections.generic; using system.windows; using system.windows.media; using system.reflection;  namespace systemcolors1 {     public partial class mainwindow : window     {         public mainwindow()         {             initializecomponent();              list<colorandname> l = new list<colorandname>();              foreach (propertyinfo in typeof(system.windows.systemcolors).getproperties())             {                 if (i.propertytype == typeof(color))                 {                     colorandname cn = new colorandname();                     cn.color = (color)i.getvalue(new color(), bindingflags.getproperty, null, null, null);                     cn.name = i.name;                     l.add(cn);                 }             }              systemcolorslist.datacontext = l;         }     }      class colorandname     {         public color color { get; set; }         public string name { get; set; }     } } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -