External hyperlink to Visual studio lightswitch screen
-
26-10-2019 - |
Question
I have a Visual studio lightswitch web application with a few screens. I want to create hyperlinks which will open a specific screen when the user clicks on it. Let say one example is to send a link in email which points to the add screen.
One bonus would be to even select an entity on the screen with a link. Like: http:\app.com\companies\id=4
Solution
It seems like it is not supported out of box but with a few lines of codes it can be implemented.
Url parameters are stored in System.Windows.Browser.HtmlPage.Document.QueryString
however the object cannot be access directly you need to use Microsoft.LightSwitch.Threading.Dispatchers.Main.BeginInvoke
After you have the parameters you just need to fire up the necessary screen and change the SelectedItem. A tiny addition that SelectionChanged()
method also needs to be called to reflect the change in the UX.