Page 31 XAML

复杂属性:(属性元素语法)

Parent.PropertyName

标记扩展

<Button... Foreground="{x:Static SystemColors.ActiveCaptionBrush}">

<Button ...>

  <Button.Foreground>

    <x:Static Member="SystemColors.ActiveCaptionBrush"></x:Static>

  </Button.Foreground>

</Button>

附加属性

<TextBox ... Grid.Row="0">

XAML解析器的调用方式:DefiningType.SetPropertyName()

嵌套元素

<LinearGradientBrush>

  <LinearGradientBrush.GradientStop>

    <GradientStop Offset="0.00" Color="Red"></GradientStop>

    <GradientStop Offset="0.50" Color="Indigo"></GradientStop>

    <GradientStop Offset="1.00" Color="Violet"></GradientStop>

  </LinearGradientBrush.GradientStop>

</LinearGradientBrush>

特殊字符与空白

&lt;  (<)  &gt;  (>)  &amp;  (&)  &quot;  (")

<TextBox Name="txtQuestion" xml:space="preserve">

    [There is a lot of space inside these quotation marks "      "]

</TextBox>

使用其他名称空间中的类型

xmlns:Prefix="clr-namespace:Namespace;assembly=AssemblyName"

<Window ... xmlns:sys="clr-namespace:System;assembly=mscorlib" ... >

  <ListBox>

    <ListBoxItem>

      <sys:DateTime>10/13/2010 4:30 PM</sys:DateTime>

    </ListBoxItem>
  </ListBox>

</Window>

posted @ 2011-10-07 19:29  jacky_j2ee  阅读(121)  评论(0)    收藏  举报