- Mastering Visual Studio 2017
- Kunal Chowdhury
- 139字
- 2021-07-15 17:26:42
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:

- C語言程序設(shè)計(jì)案例教程
- Mastering C# Concurrency
- Learning Python Design Patterns(Second Edition)
- Silverlight魔幻銀燈
- 微信小程序入門指南
- C#應(yīng)用程序設(shè)計(jì)教程
- Visual Basic程序設(shè)計(jì)
- 執(zhí)劍而舞:用代碼創(chuàng)作藝術(shù)
- Python圖形化編程(微課版)
- Vue.js 2 Web Development Projects
- Learning Docker Networking
- Kubernetes進(jìn)階實(shí)戰(zhàn)
- Tableau Desktop可視化高級(jí)應(yīng)用
- Secret Recipes of the Python Ninja
- Anaconda數(shù)據(jù)科學(xué)實(shí)戰(zhàn)