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

- Node.js 10實戰
- Hyper-V 2016 Best Practices
- Visual FoxPro程序設計教程
- PHP基礎案例教程
- Python測試開發入門與實踐
- Elasticsearch for Hadoop
- C語言程序設計教程
- PHP編程基礎與實例教程
- Bootstrap 4 Cookbook
- Statistical Application Development with R and Python(Second Edition)
- Clojure Web Development Essentials
- 數據結構與算法詳解
- 美麗洞察力:從化妝品行業看顧客需求洞察
- Scratch 3.0少兒積木式編程(6~10歲)
- Mastering Puppet(Second Edition)