locked
making website in silverlight RRS feed

  • Question

  • recently i am making a website in silverlight. but i met some questions.

    who had made a website in silverlight,only using silverlight.

     

    Monday, December 15, 2008 3:13 AM

Answers

  • hi, i made a zip with a working app how can i send it to you?

    Tuesday, December 16, 2008 6:29 AM

All replies

  • Hello, I'm doing one ;)

    Monday, December 15, 2008 4:00 AM
  • hello, can i ask you a question?

    i made two silverlight project.(page1.xaml and page2.xaml)

    i want to have a connect between the two pages. when i click the page1.xaml's control then connect to the page2.xaml.

    can you tell me the method? i think there has a simply method about this. like "Link" in asp.net.

    Monday, December 15, 2008 5:40 AM
  • Hello!
    I don't precilsely understand what you mean for connect...anyway I guess you can define page1 and page2 as usercontrols , then you can create a page.xaml where you add the two usercontrols page1 and page2. Then when you click une control you can set the visibility of the second one as you like.

    You can even pass parameters. I usually define a Show(<some parameter>) method for my controls...

     

    in your case when you click a button inside page1 (for example) you can do:

    ...
    ...

    page2.Show("Hello");

    hope this helps you. I'm here :)

    Bye.

    Monday, December 15, 2008 6:01 AM
  • thanks for your answer. but i want to know,

    i created a page.xaml where i added the two usercontrols page1 and page2.

    if there tow button controls(button1 and button2) in the page.xaml. i want to get when i click the button1,i can display the page1.xaml and when i click the button2,i can display the page2.

    i'm a new learner.

    i hope you help me.thanks!

    Monday, December 15, 2008 7:07 AM
  • Ok,
     in the click event handler of button1 :

     ...

    page1.Visibility = Visibility.Visible;

    page2.Visibility = Visibility.Collapsed;

    ..

    and  in the click event handler of button2 :

     ...

    page1.Visibility = Visibility.Collapsed;

    page2.Visibility = Visibility.Visible;

    ..

     If it doen't helps you thell me more.

    Bye.

     

    Monday, December 15, 2008 8:08 AM
  • i'm sorry.

    i can't find the page1.Visibility, only can find the page1.VisibilityProperty.

    so sorry for troubling you so much.

    Monday, December 15, 2008 8:29 AM
  • Don't worry, no trouble...

    So, that's strange.. I put here a working UserControl example where you can find the Visibility in the code behind...

    Make sure to add that user control correctly in your page.xaml (in this case add xmlns:my="clr-namespace:Silverlight")

     Let me know...

     

     

     

    <UserControl x:Class="Silverlight.DialogBox"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Grid>

    <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0.3" Fill="Gray" />

    <Border Width="550" Height="150" CornerRadius="5" Background="White" VerticalAlignment="Top" Margin="0,250,0,0" >

    <Grid ShowGridLines="False">

    <Grid.RowDefinitions>

    <RowDefinition Height="40"/>

    <RowDefinition Height="*"/>

    <RowDefinition Height="20"/>

    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>

    <ColumnDefinition Width="50"/>

    <ColumnDefinition Width="*" />

    <ColumnDefinition Width="50" />

    </Grid.ColumnDefinitions>

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="0" Grid.Column="1">

    <TextBlock x:Name="tbTitle" Margin="10,10,10,10" Foreground="Black" FontFamily="Arial" FontSize="16"/>

    </StackPanel>

    <Button x:Name="btnClose" Content="x" Click="btnClose_Click" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="0" Grid.Column="2" Margin="5,5,5,5" />

    <ScrollViewer Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3">

    <TextBlock x:Name="tbMessage" Margin="10,10,10,10" TextWrapping="Wrap" Foreground="Black"/>

    </ScrollViewer>

    </Grid>

    </Border>

    </Grid>

    </UserControl>

     

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Net;

    using System.Windows;

    using System.Windows.Controls;

    using System.Windows.Documents;

    using System.Windows.Input;

    using System.Windows.Media;

    using System.Windows.Media.Animation;

    using System.Windows.Shapes;

    namespace Silverlight

    {

    public partial class DialogBox : UserControl

    {

    public DialogBox()

    {

    InitializeComponent();

    }

    private void btnClose_Click(object sender, RoutedEventArgs e)

    {

    Visibility =
    Visibility.Collapsed;

    }

    public void Show(string title, string message)

    {

    tbTitle.Text = title;

    tbMessage.Text = message;

    Visibility =
    Visibility.Visible;

    }

    }

    }

    Monday, December 15, 2008 8:43 AM
  • i can't understand also.

    i only  want to have a connection with the Page.xaml,Page1.xaml,Page2.xaml that are in the same silverlight project.

    in the Page.xaml

            
        <UserControl x:Class="SilverlightApplication11.Page"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Width="400" Height="300"  >
        <Grid  Background="White">
            <StackPanel >
                <TextBlock x:Name="text1" Text="the first page" FontSize="24" MouseLeftButtonDown="text1_MouseLeftButtonDown"/>
                <TextBlock x:Name="text2" Text="the second page" FontSize="24" MouseLeftButtonDown="text2_MouseLeftButtonDown"/>
            </StackPanel>
        </Grid>
    </UserControl>

     and in the Event of text1_MouseLeftButtonDown,i want to connect to the Page1.xaml,

    and in  the Event of text2_MouseLeftButtonDown,i want to connect to the Page2.xaml.

    how i can do this?

    Monday, December 15, 2008 9:43 PM
  • if you add to the code you sent me the two user control (page1 and page2) and for example in and in the Event of text1_MouseLeftButtonDown you set the visibility for page1, page2 and, further for the stackpanel you'll simply get page1 showed (like have been clickking a link).

    I think this could be a solution.

    Tuesday, December 16, 2008 3:23 AM
  • i wrote that in the event but i got the error that can't find the page1 or page2 in page.xaml.

    can you write the code for me?

    and i thought another method

    i can change the start page in app.xaml.cs.

    but i also don't know the code about how i can change it in the event.

    Tuesday, December 16, 2008 5:43 AM
  • hi, i made a zip with a working app how can i send it to you?

    Tuesday, December 16, 2008 6:29 AM
  •  Hi, i think it's not good adding 2 pages as usercontrol....

    look here  http://silverlight.net/learn/tutorials/multipageapps_vb.aspx

    ;)

    Tuesday, December 16, 2008 7:20 AM
  • this is my e-mail:qingquan126778@163.com

    thanks!

    Tuesday, December 16, 2008 7:16 PM
  • i received the code source.

    thanks so much!

    Wednesday, December 17, 2008 5:10 AM
  • Oh, well. Hope that's useful!

    Please mark this post  as answer if it fits your request:)

    I'm here if you have  further questions. Bye!

    Wednesday, December 17, 2008 5:16 AM
  • Thank you! Happy holidays.

    Friday, December 19, 2008 6:54 AM