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

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:

主站蜘蛛池模板: 资溪县| 霸州市| 塘沽区| 股票| 玛多县| 阿克陶县| 洪湖市| 图木舒克市| 蒲城县| 松滋市| 平潭县| 全州县| 高青县| 紫云| 大兴区| 焉耆| 四平市| 和静县| 兴化市| 光泽县| 株洲市| 繁昌县| 土默特右旗| 稻城县| 蓬莱市| 舟曲县| 武乡县| 榆树市| 台北市| 合作市| 榆中县| 娄烦县| 广昌县| 济阳县| 金阳县| 油尖旺区| 叙永县| 诸暨市| 涞水县| 台州市| 邢台市|