XAML 基础与应用详解
1. 基础认识
在 XAML 中,我们可以通过属性来设置每个类的特性。不过,在某些情况下,属性的功能不足以完成任务,这时就需要使用带有特殊语法的嵌套标签。
以下是一个简单的 XAML 文档示例,它代表一个空白页面:
<UserControl x:Class="SilverlightApplication1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
</Grid>
</UserControl>
这个文档包含两个元素:顶级的 UserControl
元素,它包裹了页面上的所有 Silverlight 内容;以及 Grid
元素,你可以在其中放置其他元素。需要