Skip to main content
Home Forums General Silverlight New Features in Silverlight 3 Relation between silverlight usercontrol, page and Frame
3 replies. Latest Post by Ajit Kumar Jha on August 28, 2009.
(0)
Ajit Kum...
Member
31 points
15 Posts
08-27-2009 1:33 AM |
Hello all,
I have one question in my mind, because I am new in silverlight so don't get angry if question looks stupid.
Silverlight has three basic container mechanism
1. Usercontrol,
2. Page
3. Frame
Actually what is relation between them as an architecture point of view?
Is usercontrol same as in asp.net?
Is Page is same as in asp.net?
Can we have any Usercontrol in my page?
How the Frame is using page in Frame Navigation framework?
Thanks in Advance
Pravinku...
Contributor
4300 points
708 Posts
08-27-2009 3:32 AM |
Hi,
Just check this link. Read it carefully. I guess many of your questions will be solved. Don't forget to click the links in artical -
http://msdn.microsoft.com/en-us/library/cc189034(VS.95).aspx#object_trees
Let me know if this helps you.
Thanks,
Pravin
"Please mark as answered, if this answers your question"
08-27-2009 3:55 AM |
Check this as well-
http://silverlight.net/forums/t/32569.aspx
-> The question is not clear.
-> Check these links -
http://www.silverlightshow.net/items/The-Silverlight-3-Navigation-Framework.aspx
http://www.c-sharpcorner.com/UploadFile/dpatra/SilverlightNavigationFramework05282009032422AM/SilverlightNavigationFramework.aspx
08-28-2009 3:32 AM |
Thanks for reply,
I am going through the links sent by you.
Actually this question says that Can a silverlight Page (object of the page class) contains a usercontrol.
I got the answer also after searching on the net
the answer is
Usercontrol is just like another control which you can place in any other container control( this can be a grid, canvas, stackPanel or another usercontrol and any Page(Navigation Page). You can do it using two ways . 1. using xaml 2. using code view.
1. using xaml.
just include xmlns:test="clr-namespace:TestUserControl" where
Test is any string you can keep as prefix of your control. and
TestUserControl is the name space in which the silverlight usercontrol resides.
then
<navigation:Page x:Class="SilverlightApplication1.Page1" 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" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:test="clr-namespace:TestUserControl " Title="Page1 Page"> <Grid x:Name="LayoutRoot" ShowGridLines="True"> <Grid.RowDefinitions> <RowDefinition Height="20"></RowDefinition> <RowDefinition Height="*"></RowDefinition> <RowDefinition Height="20"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Text="Hello Welcome to the SilverLight" Grid.Row="0" Grid.Column="0"></TextBlock> <TextBlock Text="This is footer." Grid.Row="2" Grid.Column="0"></TextBlock> <test:TestUserControl Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0"></test:TestUserControl> </Grid></navigation:Page>
2. using code view you can create the instance of usercontrol and add it in the children list of the containercontrol such as grid.