- 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:

- Computer Vision for the Web
- Maven Build Customization
- MySQL數(shù)據(jù)庫(kù)應(yīng)用與管理 第2版
- Twilio Best Practices
- BeagleBone Media Center
- Teaching with Google Classroom
- 現(xiàn)代C++編程實(shí)戰(zhàn):132個(gè)核心技巧示例(原書(shū)第2版)
- BeagleBone Robotic Projects(Second Edition)
- Sails.js Essentials
- 實(shí)驗(yàn)編程:PsychoPy從入門到精通
- Unity 5 Game Optimization
- Building Web and Mobile ArcGIS Server Applications with JavaScript(Second Edition)
- 分布式系統(tǒng)架構(gòu)與開(kāi)發(fā):技術(shù)原理與面試題解析
- LabVIEW數(shù)據(jù)采集(第2版)
- Thymeleaf 3完全手冊(cè)