无法在Silverlight中更改按钮背景颜色 [英] Can't change button background colour in silverlight

查看:85
本文介绍了无法在Silverlight中更改按钮背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2010的Silverlight应用程序中创建一个多页画廊网站.我添加了用于导航到不同页面的按钮,但是当我在属性中更改背景颜色时,颜色不会更改吗?

代码:

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>

推荐答案

样式和模板在SilverLight控件设计中起着至关重要的作用.您可以在以下位置引用SilverLight按钮样式和模板: http://msdn. microsoft.com/en-us/library/cc278069%28v=VS.95%29.aspx [
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[^]


这篇关于无法在Silverlight中更改按钮背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆