I'm attempting to use HyperlinkColumn inside a silverlight navigation app. SL navigation apps use named anchors for navigation between different pages in the same app like:
#/SrvTry1?AccountID=130129&OnlyActive=True
or
#/Circuits?CircuitID=24
I don't think your HyperlinkColumn class is handling this type of relative URI correctly. I have the following setup:
When I click on the link from my DSLs page, the address in my address bar incorrectly changes from:
http://mypc/FM.Web/FMTestPage.aspx#/DSLs
to
http://mypc/FM.Web/FMTestPage.aspx#/DSLs$/Circuits?CircuitID=73
instead of:
http://mypc/FM.Web/FMTestPage.aspx#/Circuits?CircuitID=73
like it should be.
My hyperlink column is bound to a property that returns a Uri of the following type:
return new Uri(string.Format("#/Circuits?CircuitID={0}", CircuitID), UriKind.Relative);
Futher,
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(string.Format("#/Circuits?CircuitID={0}", CircuitID), UriKind.Relative));
works as you would expect so I don't think it is a problem my code but could be wrong of course.
Relatedly, the relevant XAML for this is:
<ig:HyperlinkColumn Key="CircuitIDUri" ContentBinding="{Binding CircuitID}" HeaderText="CircuitID" />
It sure would be nice if the filtering was smart enough to work off the ContentBinding instead of the Key - because as is filtering doesn't work on HyperlinkColumns but it would be nice if it did.
Hello,
I am looking into the vaigation issue for you and I will enter a feature request for the sort using the ContentBinding, however in the meantime you should be able to create a custom sort for the column. Please see
http://help.infragistics.com/Help/NetAdvantage/Silverlight/2011.1/CLR4.0/html/SL_xamGrid_Custom_Sort.html
for more information.
Valerie
Thanks for looking at the navigation problem - I suspect other people will run into it at some point as the navigation framework they have is fairly handy for business apps.
Upon further reflection, I kinda wish you had made HyperLink column work the other way where you just specified "CircuitID" as the "Key" and then specified another XAML parameter like "URIBinding" for the link - then sorting/grouping/filtering would just work (or you could have just made URIBinding an optional property on TextColumn where if it is set the text shows up as a hyperlink instead of just plain text like now). Unless I hear back from you on a fix for the navigation bug, I'm thinking I'll just create my own custom column type that behaves this way but it of course may not be as easy as I think it will be. :-)
After doing a little more reading, this turns out to be a bug with silverlight navigation apps in general. Apparently, they didn't want you navigating away from your apps, so the NavigateUri stuff on hyperlink buttons doesn't work correctly unless you set it to open a new window which is not what I wanted. Inside of navigation apps, you have to use:
System.Windows.Browser.
HtmlPage.Window.Navigate(...)
or similar to jump between pages in the same app. My custom cell/column type is working nicely - I just do the right thing inside my click handler. Sorry for not discovering this page earlier - might be good to put a note in the documentation for HyperlinkColumn somehwere though that mentions this since it is poorly documented on Microsoft's side.
I am glad you were able to resolve your issue and I appreciate the feedback. I will pass your suggestions on to our product management team for consideration.