visual studio 2010 - WPF styles not being applied from App.xaml -
i'm looking apply styling wpf controls can done css in html.
this first dabbling in wpf , i've collected need in app.xaml. below i've got.
i've tried targettype="{x:type tabitem}"
, targettype="tabitem"
.
none of styles i've defined being applied.
app.xaml
<application x:class="vmware_lab_manager_desktop.app" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" startupuri="mainwindow.xaml"> <application.resources> <resourcedictionary source="styles.xaml"></resourcedictionary> </application.resources> </application>
styles.xaml
<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <style targettype="{x:type tabcontrol}"> <setter property="background"> <setter.value> <lineargradientbrush endpoint="0.5,1" startpoint="0.5,0"> <gradientstop color="#ff464646" offset="0" /> <gradientstop color="#ff2d2d2d" offset="0.5" /> <gradientstop color="#ff141414" offset="1" /> </lineargradientbrush> </setter.value> </setter> </style> <style targettype="{x:type tabitem}"> <setter property="background"> <setter.value> <lineargradientbrush endpoint="0.5,1" startpoint="0.5,0"> <gradientstop color="#ff464646" offset="0" /> <gradientstop color="#ff2d2d2d" offset="0.5" /> <gradientstop color="#ff141414" offset="1" /> </lineargradientbrush> </setter.value> </setter> <setter property="borderbrush"> <setter.value> <lineargradientbrush endpoint="1,0.5" startpoint="0,0.5"> <gradientstop color="black" offset="0" /> <gradientstop color="#ff464646" offset="1" /> </lineargradientbrush> </setter.value> </setter> </style> <style targettype="{x:type window}"> <setter property="background"> <setter.value> <lineargradientbrush endpoint="1,0.5" startpoint="0,0.5"> <gradientstop color="#ff2d2d2d" offset="0.5" /> <gradientstop color="#ff141414" offset="0" /> <gradientstop color="#ff464646" offset="1" /> </lineargradientbrush> </setter.value> </setter> </style> </resourcedictionary>
mainwindow.xaml
<window x:class="vmware_lab_manager_desktop.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="456" width="803" padding="0" margin="0"> <tabcontrol horizontalalignment="stretch" margin="0" padding="0" name="tabcontrol1" verticalalignment="stretch" borderthickness="0" tabstripplacement="bottom"> <tabitem name="tabitem1" header="..."> <webbrowser horizontalalignment="stretch" name="webbrowser1" margin="0" verticalalignment="stretch" source="http://www.msdn.com/" /> </tabitem> <tabitem header="+" /> </tabcontrol> </window>
<application.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="style.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> </application.resources>
Comments
Post a Comment