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

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:

主站蜘蛛池模板: 张北县| 恭城| 绍兴县| 阜新市| 班戈县| 永福县| 湖州市| 盐山县| 清流县| 雅江县| 富川| 辽源市| 辽源市| 奉新县| 淮南市| 平昌县| 大城县| 南投市| 韩城市| 五指山市| 丽江市| 镇平县| 浮山县| 澎湖县| 林周县| 大宁县| 南开区| 新闻| 南和县| 凤庆县| 上饶县| 汾西县| 梅州市| 苍梧县| 封开县| 金寨县| 永兴县| 耿马| 忻城县| 鄂伦春自治旗| 海丰县|