Click here to Skip to main content
15,905,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm making a multipage art gallery website in a silverlight application on visual studio 2010. I've added buttons for navigation to different pages, but when I change the background colour in the properties the colour does not change?

Code:

<usercontrol x:class="LondonArtGallery.MainPage" xmlns:x="#unknown">
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="531" d:DesignWidth="882" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <grid x:name="LayoutRoot" removed="#FF345C3E" height="531" width="882">
        <grid.rowdefinitions>
            <rowdefinition height="107*" />
            <rowdefinition height="424*" />
        </grid.rowdefinitions>
        <Button Content="Home" FontSize="16" Height="37" HorizontalAlignment="Left" Margin="76,13,0,0" Name="btnhome" VerticalAlignment="Top" Width="85" Grid.Row="1" Foreground="#FF211F1F" Background="#FF0D0DF8" Click="btnhome_Click">
            <Button.BorderBrush>
                <lineargradientbrush>
                    <gradientstop color="#FFA3AEB9" offset="0" />
                    <gradientstop color="#FF8399A9" offset="0.375" />
                    <gradientstop color="#FF718597" offset="0.375" />
                    <gradientstop color="#8B231056" offset="1" />
                </lineargradientbrush>
            </Button.BorderBrush>
        </Button>
        <textbox grid.row="1" height="239" horizontalalignment="Left" margin="76,48,0,0" name="txtContent" verticalalignment="Top" width="698" text="Welcome to the London Art Gallery website. Here you can view contempary artwork from some of the best artists today" textchanged="textBox1_TextChanged" verticalscrollbarvisibility="Visible" />
        <Image Height="107" HorizontalAlignment="Left" Margin="229,0,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="653" Source="/LondonArtGallery;component/Images/Banner.jpg" />
    </grid>
</usercontrol>
Posted
Updated 13-Nov-11 5:23am
v2
Comments
Mark Salsbery 13-Nov-11 10:56am    
Show code! Do your buttons have a template that uses the Background property? The default button template may use a gradient or opaque version of the background color (see Button Styles and Templates[^]). Do you see your color when cursor moves over the buttons?
programmer1234 13-Nov-11 11:23am    
Code is now displayed in the question
Mark Salsbery 13-Nov-11 11:32am    
Cool thanks. If setting the Background property alone isn't giving you the look you want then you still may need to re-template the control to get your desired look. See the default template at the link I posted above.
programmer1234 13-Nov-11 11:45am    
That worked, thanks for your help.
thatraja 13-Nov-11 14:19pm    
Oops, I couldn't give you 5 here

1 solution

Styles and templates play a vital role in SilverLight control design. You can refer SilverLight button styles and templates at: http://msdn.microsoft.com/en-us/library/cc278069%28v=VS.95%29.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900