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

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:

主站蜘蛛池模板: 进贤县| 南阳市| 木里| 买车| 神木县| 阳泉市| 元谋县| 芦溪县| 璧山县| 徐水县| 台东市| 茶陵县| 喀喇沁旗| 保山市| 巴林左旗| 江达县| 屯留县| 海林市| 东莞市| 江孜县| 万山特区| 华安县| 湖州市| 绥宁县| 肇源县| 阳谷县| 张家界市| 西峡县| 滁州市| 昌乐县| 南涧| 江达县| 大冶市| 临海市| 垦利县| 凤阳县| 马龙县| 东平县| 丹阳市| 景洪市| 金山区|