官术网_书友最值得收藏!

Content syntax

An XAML element can have content within it. It can be set as the value of child elements of root. Refer to the following code blocks. The first example shows how to set the text content property of a button instead of specifying it in an attribute syntax (<Button Content="Click Here" />):

    <Button> 
      <Button.Content> 
          Click Here 
      </Button.Content> 
    </Button> 

In the following example, when the Button element is wrapped by a Border panel, it is defined as element content of the said panel and omits the explicit definition of the content property:

    <Border> 
       <Button Content="Click Here" /> 
    </Border> 

The preceding code can be rewritten with a Content property (Border.Child) having a single element in it:

    <Border> 
       <Border.Child> 
          <Button Content="Click Here" /> 
       </Border.Child> 
    </Border> 

The value of an XAML content property must be contiguous and hence the following definition is incorrect:

Also, you cannot define an XAML content property like this, where you are trying to put the content twice:

主站蜘蛛池模板: 清镇市| 佳木斯市| 莎车县| 平顶山市| 亚东县| 皮山县| 抚顺市| 翼城县| 滦南县| 承德县| 都安| 天柱县| 龙陵县| 长沙县| 开封县| 呼和浩特市| 庐江县| 阿尔山市| 泰来县| 奈曼旗| 庆安县| 永昌县| 正安县| 新昌县| 额济纳旗| 于田县| 德兴市| 奉化市| 周至县| 洛阳市| 陇西县| 浙江省| 油尖旺区| 靖江市| 越西县| 九寨沟县| 开远市| 大足县| 静宁县| 衡水市| 阳城县|