none
Blend 2 button link to project page

    Question

  • Hi

     Is there a way to make a button when clicked to open another xaml page in the project? Ive got one welcome.xaml and when someone clikcs the button I want it to open another page.xaml in the same project.

     BR

    Christian

    Monday, February 11, 2008 4:42 AM

Answers

  • aha thanx. Arent there and equlant to scenes in flash in Expression blend?

    Monday, February 11, 2008 7:08 AM

    • In Blend 2, you should use "Silverlight Application (.NET Orcas)" project type.
    • Create the animation or things that you like in Blend 2.
    • Open VS 2008,
    • Use Silverlight 1.1 project (You will have TestPage.html and Page.xaml)
    • Put the button that you create with Blend 2 in Page.xaml
    • Attach one click event (leftmousebuttonup ) event to that button
    • Wrote the code that I give you.
    • Add one more HTML page and JS. (let's say PopupPage.html, PopupPage.html.js and PopupPage.xaml)
    • Host the PopuPage.xaml in PopupPage.html
    • That's all.
    Monday, February 11, 2008 7:12 AM
  • Unfortunately implementing scenes as easily as it is done in Flash is not currently available in Silverlight, you can work around the limitation and simulate scenes, but it is not as easy as selecting gotto action in Flash

    Monday, February 11, 2008 8:04 AM

All replies

  • Is there a way to make a button when clicked to open another xaml page in the project?
     

    You can use this code HtmlPage.Navigate(new Uri("http://yourdomain.net/yourotherTestPage.html"),“__newWindow”); in click event of your button.

    Monday, February 11, 2008 4:50 AM
  • How do I add the text in the event? it says that the code code doesnt work when i paste it into click under events in blend 2. Ive clicked on the event button that is placed in the Properties tab and paste the code under click but that didnt work.

     Isnt there a built in solution for opening or switching between two pages? onlick goto page2.xaml kinda solution?

    Monday, February 11, 2008 4:57 AM
  • How do I add the text in the event
     

    Which text are you talking about?

    Your question is that you want to open another silverlight page in new window, right? Let's say. There are two HTML pages in your project. Let's called WelcomePage.html and PopupPage.html. WelcomePage.html has Welcome.xaml and it also has custom Silverlight button control. PopupPage.html has Popup.xaml.

    You run the application so WelcomePage.html is showing. If the user clicks on the button control of WelcomePage.html page.
    you want to open PopupPage.html in new window.

    I told you to write the code below in click event  of your custom button.  

    HtmlPage.Navigate(new Uri("http://yourdomain.net/yourotherTestPage.html"),“__newWindow”)

    Ive clicked on the event button that is placed in the Properties tab and paste the code under click but that didnt work.
     

    actually, you should attach the event from code-behind.  (I hope you are not confused with WPF project.)

     

     

    Monday, February 11, 2008 5:11 AM
  • Im sorry but I guess im confusing things. Im working in Expression Blend2 Project where there aint no html files, only .xaml. By default one get a window1.xaml to work with but I added a new window called heating.xaml with a diffrent layout. Now I want a button on the window1.xaml that when clicked on it opens and runs heating.xaml.

    Monday, February 11, 2008 5:23 AM
  • Im sorry but I guess im confusing things. Im working in Expression Blend2 Project where there aint no html files, only .xaml. By default one get a window1.xaml to work with but I added a new window called heating.xaml with a diffrent layout. Now I want a button on the window1.xaml that when clicked on it opens and runs heating.xaml.

    Hi are you using Silverlight 1.1 or Silverlight 1.0 ? There is a code behind file that runs your script/managed code for the xaml, if you have heating.xaml then you will have heating.xaml.js (Silverlight 1.0) or heating.xaml.cs or heating.xaml.vb (for Silverlight 1.1) application, you have to run your scripts in that file.

    Monday, February 11, 2008 5:29 AM
  • hi I am using Silverlight 1.1. Well I tought there would be and easy way to interact between pages. Just like making a button start and run a storyboard make the button when clicked load heating.xaml. If it aint that easy I guess I stick to Flash. Thanx for the help all!

    Monday, February 11, 2008 5:36 AM
  • The project structure you are describing is a WPF application structure. You need to create another project either as Silverlight 1.0 project or 1.1. There will be a default.html page generated for you. But redirecting to another page using html navigate is not the optimal solution for going from a welcome page to another page as it will enforce a trip to the server.

    A better solution in my opinion is:

    Have your first page contains only a root convas, and on the load event use a downloader object to download your welcome.xaml page, instantiate it using createFromXaml,  add it as a child to the root canvas. Whenever you need to load another page, display a loading animation, use a downloader object to download the new xaml file, instantiate the object using createFromXaml, remove the old child canvas, and add the new canvas as a child to the root canvas.

    Monday, February 11, 2008 5:42 AM
  • aha thanx. Arent there and equlant to scenes in flash in Expression blend?

    Monday, February 11, 2008 7:08 AM

    • In Blend 2, you should use "Silverlight Application (.NET Orcas)" project type.
    • Create the animation or things that you like in Blend 2.
    • Open VS 2008,
    • Use Silverlight 1.1 project (You will have TestPage.html and Page.xaml)
    • Put the button that you create with Blend 2 in Page.xaml
    • Attach one click event (leftmousebuttonup ) event to that button
    • Wrote the code that I give you.
    • Add one more HTML page and JS. (let's say PopupPage.html, PopupPage.html.js and PopupPage.xaml)
    • Host the PopuPage.xaml in PopupPage.html
    • That's all.
    Monday, February 11, 2008 7:12 AM
  • Unfortunately implementing scenes as easily as it is done in Flash is not currently available in Silverlight, you can work around the limitation and simulate scenes, but it is not as easy as selecting gotto action in Flash

    Monday, February 11, 2008 8:04 AM
  • Hello, I am having a similar problem. I have a <iframe> and inside this tag I have the entire project. Outside of this tag I have a silverlight menu. How do I by the link silverlight menu pointing into the iframe?
     
    thanks
     
    Rhamses
     
    BR 
    Monday, February 25, 2008 1:17 PM
  • Im with the same problem, a menu in silverlight and the content in a iframe, need to change the source of iframe on menu interact,  please someone? 

    Monday, March 31, 2008 9:46 AM
  • I discovered how do this ...   in the event (Silverlight App) that you want to load the page in iframe on aspx put the code:

    HtmlElement frame = HtmlPage.Document.GetElementById("iframeID");
    frame.SetProperty("src", "url"); // url , example Default.aspx

    Here works! 

    Monday, March 31, 2008 10:33 AM
  • Hey guys,

    You need to include

    using System.Windows.Browser;

    And then the link works as

    HtmlPage.Window.Navigate(new Uri("http://yourdomain.net/yourotherTestPage.html"),"__newWindow");

    (Note the extra include of .window.) 

    *Make sure when you copy it out to replace the quotes " as they will probably copy as formatted weird ones.

    Cheers.

    Wednesday, June 04, 2008 2:56 AM
  •  Nice!

    I have another question. Is it possible to open a html page in a silverlight project. So lets say i have a button in silverlight wich i click and then it opens in some kind of target grid. Maybe some kind of Iframe in silverlight or something? 

    Thursday, June 05, 2008 3:03 AM