Should the Silverlight root tag be UserControl or Canvas?

I am reading Silverlight 2 Unleashed, published in October 2008, and it has examples with a canvas tag:

<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"...

However, when I create a new Silverlight application in VS2008, I get the UserControl root tag:

<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"...

Of course, I can change this by replacing the root Canvas tag, but then I need to also change the code behind to inherit Canvas instead of UserControl and take out the InitializeComponent method.

  • Is the Canvas tag used as the root standard or a book on an alternative way to create Silverlight applications?
  • What are the benefits of using Canvas instead of UserControl as the root element?
  • Why did the book for its first examples create Silverlight applications differently than the default in Visual Studio?
  • , Visual Studio canvas, ?
+5
2

Canvas XAML . , XAML - SilverlightPad. , XAML, ( ).

, XAML XAML. Visual Studio , XAML UserControl UserControl , . , , , -. , , , XAML - , "" .

Silverlight 2 Unleashed , ( ) . , , Visual Studio , . , , , , .

, .

Cheers, Laurent

+4

, , , - . , , , .

, UserControl . - , Canvas UserControl. [Edit:] Grid Canvas - , Canvas!

- ; - , . , Grids, DockPanels / StackPanels. , , .:)

, . Canvas -, , .

0

All Articles