locked
Expression Blend 4 HyperLink RRS feed

  • Question

  • Hi,

    I'm writing a web application with Expression Blend 4. I'm not be able to create a simple HyperLink. I want to introduce a hyperlink in an image. I've dragged the asset HyperLinkAction in the image and i've changed its properties (with URI for example http://www.google.com) , but it doesn't work. How i can do it?

    Thanks

    petzyou

    Monday, June 25, 2012 9:37 AM

All replies

  • Hello Petzyou.

    It sounds as if you already did it correctly.  Check your xaml code against the following and see if anything is missing...

    	<Grid x:Name="LayoutRoot" Background="White">
    		<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="My Link" VerticalAlignment="Top" Cursor="Hand">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="MouseLeftButtonDown">
    					<ei:HyperlinkAction NavigateUri="http://google.com" TargetWindow="_new"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</TextBlock>
    	</Grid>

    Additionally I would check that the object you have applied the hyperlink action to is hit-test-visible and that there is nothing over it which would prevent you from clicking it.

    Hope you get it worked out.

    ~Christine

    P.S.  Also if you have a transparent item and you are clicking within the transparent area it would not work, unless you actually change the color to say "Transparent".

    ex...

    		<Rectangle HorizontalAlignment="Left" Height="100" Stroke="Black" Fill="Transparent" VerticalAlignment="Top" Width="100" Margin="41,58,0,0" StrokeThickness="2" RadiusX="5" RadiusY="5" Cursor="Hand">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="MouseLeftButtonDown">
    					<ei:HyperlinkAction NavigateUri="http://google.com" TargetWindow="_new"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</Rectangle>


    My Gallery


    Monday, June 25, 2012 1:20 PM
  • Use a HyperlinkButton with an Image inside of it (basically the same thing you're already doing, just backwards).

    <HyperlinkButton>
        <Image Height="100" Width="100"/>
    </HyperlinkButton>


    Monday, June 25, 2012 1:30 PM
  • Hi,

    doesn't work. it seems that all my application is disabled to receive commands from mouse. Infact i put in a simple button and when i run my application i'm not be able to click on button  

    Tuesday, June 26, 2012 10:11 AM
  • This is the code of HyperlinkActionin a Image:

    <Image x:Name="mappaChiesa" HorizontalAlignment="Right" Margin="0,197,12,8" Width="248" Source="/mappaChiesa.png" Stretch="Fill">
    <i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseLeftButtonDown">
    <ei:HyperlinkAction TargetWindow="_blank" NavigateUri="http://maps.google.com/maps q=Via+Mazzarino,+16,+Roma,+Italia&amp;hl=it&amp;sll=41.912496,12.494936&amp;sspn=0.833915,1.783905&amp;oq=via+&amp;t=v&amp;hnear=Via+Mazzarino,+16,+00184+Roma,+Lazio,+Italia&amp;z=17"/>
    </i:EventTrigger>
    </i:Interaction.Triggers>

    </Image>

    but i cannot click on image and open a new browser tab.


    Tuesday, June 26, 2012 10:18 AM
  • If a simple button doesn't work, it doesn't surprise me that the MouseLeftButtonDown EventTrigger isn't getting handled by your Image. My question would be why you can't click a button in the first place. Is there something else that's handling click events near your image/button? It could be the mouse events are being handled elsewhere, and they're just not making it to your particular controls. Could you post more of your XAML?

    Tuesday, June 26, 2012 12:51 PM
  • Maybe i found where is the problem.

    In my application i have one Grid that contains other 2 Grids. Each of these grids is a web page which are chosen by RadioButtons.

    The HyperlinkAction and the HyperlinkButton works only in the first grid but doesn't work in the second one. It seems that second grid has not the focus. How i can do?

    Let me know.

    Thanks

    petzyou 


    • Edited by petzyou Tuesday, June 26, 2012 12:56 PM
    Tuesday, June 26, 2012 12:53 PM
  • That seems entirely reasonable. If there's something preventing the second grid from getting focus, it could also be preventing mouse events over those elements. It would all depend on how you have things coded. Please post more of your XAML so we can see what's going on.
    Tuesday, June 26, 2012 12:54 PM
  • Hi,

    i modified the PathLayout project sample of Expression Blend 4.

    I inserted one HyperlinkButton in first grid inside the main grid called "MainContent" and the second HyperlinkButton in second grid.

    When i run my project, i'm be able to click only the HyperlinkButton inside the first grid but  i'm not be able to click the second HyperlinkButton (in the second grid). Why?

    Thanks for the help.

    petzyou

    Tuesday, June 26, 2012 5:55 PM