
作用域:定义所有的样式
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication1.App" > <Application.Resources> <Style targettype="button"> <Setter Property="Background" Value="Beige"></Setter> <Setter Property="FontSize" Value="25"></Setter> <Setter Property="Foreground" Value="Blue"></Setter> <Setter Property="margin" Value="20"></Setter> </Style> </Application.Resources></Application>
一般的样式引用
<UserControl x:Class="SilverlightApplication1.SilverlightControl1" 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="300" d:DesignWIDth="400"> <UserControl.Resources> <Style x:Key="button1" targettype="button"> <Setter Property="Background" Value="Beige"></Setter> <Setter Property="FontSize" Value="25"></Setter> <Setter Property="Foreground" Value="Blue"></Setter> <Setter Property="margin" Value="20"></Setter> </Style> <Style x:Key="button2" targettype="button"> <Setter Property="Background" Value="Wheat"></Setter> <Setter Property="FontSize" Value="24"></Setter> <Setter Property="Foreground" Value="Red"></Setter> <Setter Property="margin" Value="20"></Setter> </Style> </UserControl.Resources> <StackPanel x:name="LayoutRoot1" WIDth="800" Height="180" OrIEntation="Horizontal" Background="White" HorizontalAlignment="Center"> <button Content="样式1" WIDth="200" Height="70" Style="{StaticResource button1}"/> <button Content="样式1" WIDth="200" Height="70" Style="{StaticResource button2}"/> <button Content="样式3" WIDth="200" Height="80" > <button.Style> <Style targettype="button"> <Setter Property="Background" Value="Red"></Setter> <Setter Property="FontSize" Value="20"></Setter> <Setter Property="Foreground" Value="Beige"></Setter> <Setter Property="margin" Value="20"></Setter> </Style> </button.Style> </button> <button Content="App"></button> </StackPanel></UserControl> 总结 以上是内存溢出为你收集整理的silverlight样式1全部内容,希望文章能够帮你解决silverlight样式1所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)