【发布时间】:2009-02-06 16:36:39
【问题描述】:
我正在阅读 2008 年 10 月发布的 Silverlight 2 Unleashed,其中包含带有根画布标签的示例:
<Canvas xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="Red"
Width="500"
Height="300">
<Ellipse Width="400"...
但是,当我在 VS2008 中创建一个新的 Silverlight 应用程序时,我得到了一个 UserControl 根标记:
<UserControl x:Class="TestFirst.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White"...
当然,我可以通过用 Canvas 替换根标记来更改这一点,但是我还必须更改后面的代码以从 Canvas 而不是 UserControl 继承,并且必须取出 InitializeComponent 方法。
- 是使用 Canvas 标记作为根标准还是这本书正在讨论创建 Silverlight 应用程序的另一种方法?
- 使用 Canvas 代替 UserControl 作为根元素有哪些优势?
- 为什么本书的第一个示例会以不同于 Visual Studio 中默认提供的方式创建 silverlight 应用程序?
- 有没有办法在 Visual Studio 中默认生成画布标记作为根标记?
【问题讨论】:
标签: silverlight