Skip to main content

Microsoft Silverlight

Answered Question I'm trying to put hyperlink button it gives me an errorRSS Feed

(0)

banderastyle28
banderas...

Member

Member

9 points

56 Posts

I'm trying to put hyperlink button it gives me an error

 Hi everyone my problem is I have hyperlink button  in my let say page1.xaml to go to page.xaml

<HyperlinkButton  Margin="219,171,0,0" VerticalAlignment="Top" TargetName="_blank" Height="54" HorizontalAlignment="Left" Width="69" Grid.Column="1" NavigateUri="/Page2.xaml"> it gives me an error

Server Error in '/' Application.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Page1.xaml can anyone help me please

mahedi
mahedi

Member

Member

8 points

4 Posts

Re: I'm trying to put hyperlink button it gives me an error

 You can check the following as in order..

 1. Whether Page2.xaml exists

 2. Where have you placed Page2.xaml?

 3. If you have placed Page2.xaml in a folder named ABC, then write  NavigateUri="/ABC/Page2.xaml"

Thanks
Mahedi

Dont forget to click "Mark as Answer" on the post that helped you.

watabou
watabou

Member

Member

418 points

75 Posts

Answered Question

Re: I'm trying to put hyperlink button it gives me an error

Silverlight is a RIA and doesn't navigate from xaml to xaml as all youre doing is on the same page : Your website only have a package  with the .xap extension and xaml are not pages but UserControls displayed on the same web page where you put your Silverlight Control.

To go from a UserControl to another, youcan play on the opacity of your controls.

 Add your page2 UserControl on your page1.xaml ( at the bottom of your Grid/Canvas LAyoutRoot to be sure it will be display on top) and put its opacity to 0

erase your HyperLinkButton and put a simple Button instead, in which click event you will change the opacity of your Page2 UserControl to 1.

There's a lot of different way to do it, but here is the simplest :

 Page1.xaml

 <UserControl x:Class="SilverlightForum.MainPage"
    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"
    xmlns:page="clr-namespace:SilverlightForum"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
  <Grid x:Name="LayoutRoot">
       
        <Button Name="MyButton" Height="80" Width="200" Content="Go to Page2" Click="Button_Click"  />

<page:SilverlightControl1 Opacity="0" Name="Page2"/>
    </Grid>
</UserControl>

 

Page1.xaml.cs

namespace SilverlightForum
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MyButton.Opacity = 0;
            Page2.Opacity = 1;
        }
    }
}

 

PAge2.xaml

 <UserControl x:Class="SilverlightForum.SilverlightControl1"
    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="Black">

    </Grid>
</UserControl>

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)
Hope it helps !
Bastien BESSON

amyo
amyo

Contributor

Contributor

3660 points

495 Posts

Re: I'm trying to put hyperlink button it gives me an error

You can not access Page1.xaml in this way.

You can use the Navigation Framework of SL 3 instead.

 

Amyo Kabir
Solution Architect & Sr. Developer
Blog

banderastyle28
banderas...

Member

Member

9 points

56 Posts

Re: Re: I'm trying to put hyperlink button it gives me an error

I see what you are saying but the problem I have many videos  to put

 

watabou
watabou

Member

Member

418 points

75 Posts

Re: Re: I'm trying to put hyperlink button it gives me an error

if you have a lot of UserControl, then you can load theim dynamically on your Page1 ( see : http://forums.silverlight.net/forums/t/137688.aspx ).

 

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)
Hope it helps !
Bastien BESSON

banderastyle28
banderas...

Member

Member

9 points

56 Posts

Re: Re: Re: I'm trying to put hyperlink button it gives me an error

thank you for your help honestyl I'm not an expert here is my page

http://theindieshow.vircas.com/ now as you see when you click any of   the picture the video comes out I already creat xaml the page you see

then I have another xaml where it only has the media skin player with the .wmv related to the singer how to load it dynamically the videos thank you

banderastyle28
banderas...

Member

Member

9 points

56 Posts

Re: Re: Re: I'm trying to put hyperlink button it gives me an error

what about if I creat my media in .htm not xaml can I link them with

watabou
watabou

Member

Member

418 points

75 Posts

Answered Question

Re: I'm trying to put hyperlink button it gives me an error

 

The only difference with xaml is that you wont pass some request by Post or Get, but directly change some properties of your code

 

Just give some properties to your xaml with the media player as : source / title etc .. When you click the button and load your skin player, just load your source with this property.

 

If we take back the first post i gave you, let's assume you have one button for each videos ( let say button_1 / button_2 .. ), then in the click event you will just have to do something like : 

private void Button_Click(object sender, RoutedEventArgs e)
        {
Button myButton = sender as Button

switch ( myButton.Name)

{

case "Button_2" :

Page2.DynamicVideo("My video 2","/Videos/2.wmv");

break;

etc..

}

}

 

And in your page2 which contain the media player, just add a function :

DynamicVideo(string Title, string sourcePath) 

{

//Your code for giving the source to the video player and a title to display on the page

}

 

 

If you don't want to do your media player with Silverlight, you can also link the both with Hyperlink of course.

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)
Hope it helps !
Bastien BESSON

amyo
amyo

Contributor

Contributor

3660 points

495 Posts

Answered Question

Re: Re: Re: I'm trying to put hyperlink button it gives me an error

 You can use ChildWindow like below:

        <HyperlinkButton Content="Video1" Click="HyperlinkButton_Click"></HyperlinkButton>

  Code:

        private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            ChildWindowVideo cwv = new ChildWindowVideo();
            cwv.Show();
        }

 

You child window (SL 3):

<controls:ChildWindow x:Class="SilverlightApplication1.Views.ChildWindowVideo"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="400" Height="300"
           Title="ChildWindowVideo">
  <Grid x:Name="LayoutRoot" Margin="2">
    <Grid.RowDefinitions>
      <RowDefinition />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <!--Your video page xaml here-->
    <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
    <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
  </Grid>
</controls:ChildWindow>
  

Amyo Kabir
Solution Architect & Sr. Developer
Blog

banderastyle28
banderas...

Member

Member

9 points

56 Posts

Re: Re: Re: Re: I'm trying to put hyperlink button it gives me an error

now do I add video xaml code or just le say my player is in play1.xaml

which one thank you

banderastyle28
banderas...

Member

Member

9 points

56 Posts

Re: Re: Re: Re: I'm trying to put hyperlink button it gives me an error

it gives me two errors one controls is not defined. childwindow is not supported in silverlight project

amyo
amyo

Contributor

Contributor

3660 points

495 Posts

Answered Question

Re: Re: Re: Re: I'm trying to put hyperlink button it gives me an error

ChildWindow is a Silverlight 3.0 feature.

In Visual Studio SL project >> ADD>> New Item>>Select Silverlight Child Window

Check here :http://www.wintellect.com/CS/blogs/jprosise/archive/2009/04/29/silverlight-3-s-new-child-windows.aspx

and also,

http://www.uxpassion.com/2009/08/silverlight-3-tutorial-how-to-use-childwindow-webcast/

 

Amyo Kabir
Solution Architect & Sr. Developer
Blog

banderastyle28
banderas...

Member

Member

9 points

56 Posts

Re: Re: Re: Re: Re: I'm trying to put hyperlink button it gives me an error

I apreaciate thank you now one question I'm using net 4.0 it gives me a warning couldnt read  unable to find an assembly microsoft.build.task. v4.0 and hen I click on the button it pops up very tiny the child window

Min-Hong Tang - MSFT
Min-Hong...

Contributor

Contributor

3584 points

411 Posts

Answered Question

Re: Re: Re: Re: Re: I'm trying to put hyperlink button it gives me an error

Hi,

   You have to decorate the child window yourself. In your case you can put your Media player in the child window. 
   When users click a button or a img on the main page. The child window with a Media player pops up and plays the right video.

   Here is a link about how to use child window(it's a webcast):

  http://www.uxpassion.com/2009/08/silverlight-3-tutorial-how-to-use-childwindow-webcast/

Best Regards

Min-Hong Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities