Profile Picture

How to use NUrlLinkAttribute to open in a new window

Posted By C Kro 12 Years Ago
Author
Message
C Kro
Posted 12 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 2, Visits: 1

I am unable to open a URL in a new window even though I am setting the OpenInNewWindow property to true. The URL always open in the same window.

I am using the following code:

NTooltipAttribute tooltipAttribute = new NTooltipAttribute("Test Tooltip", true);

NUrlLinkAttribute redirectAttribute = new NUrlLinkAttribute(company.Url, true); // Set to true to open in new window.

NCursorAttribute cursorAttribute = new NCursorAttribute(CursorType.Hand);

NInteractivityStyle style = new NInteractivityStyle(true);

style.InteractivityAttributes.Add(tooltipAttribute);

style.InteractivityAttributes.Add(redirectAttribute);

style.InteractivityAttributes.Add(cursorAttribute);

shape.Style.InteractivityStyle = style;

NDrawingView1.Document.ActiveLayer.AddChild(shape);



Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 8:46 AM
Posts: 3,054, Visits: 4,012

Hi,

If you are using the new Nevron Thin Web control then you should not use the NUrlLinkAttribute constructor for specifying whether to open linkd in new window or not, as this is deprecated. The new way to specify whether to open new window or not is to set the OpenLinkInNewWindow property of the browser redirect tool:

NBrowserRedirectTool redirectTool = new NBrowserRedirectTool();
redirectTool.OpenLinkInNewWindow = true;
NThinDiagramControl1.Controller.Tools.Add(redirectTool);

Then to set the interactivity style of a shape you can simply use the following line of code:

NStyle.SetInteractivityStyle(shape, new NInteractivityStyle(truenull"Test Tooltip"CursorType.Hand, "http://www.nevron.com"));


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic