您的位置:首页 > 其它

Wpf 对象属性赋值---属性标签

2011-08-18 17:54 309 查看
1。给一个stop按钮赋予一个stop的图形。

如图:

View Code 1 <Window x:Class="wpf.Window1"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="Window1" Height="300" Width="300">
5 <Grid>
6 <Rectangle Width="300" Height="200">
7 <Rectangle.Fill>
8 <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
9 <LinearGradientBrush.GradientStops>
<GradientStop Offset="0.1" Color="Yellow"/>
<GradientStop Offset="0.5" Color="blue"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>

</Rectangle>
</Grid>
</Window>

原则。1,能使用attribute=value对属性赋值,尽量使用这种方式。

2,若使用默认值的属性,则可以不用写出来,

比如: <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> 默认的StartPoint为“”0,0“ 默认的EndPoint为”1,1“则可以不写出来。如下:
<LinearGradientBrush>

参考:属性标签





内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: