How to implement a Silverlight modeless child window? - silverlight

Is there any way to create a modeless child window on a Silverlight application? Basically I need to display some detailed information after user clicks on a button. User could keep working on the main page and see the detailed child window at the same time.
Thanks for any reply.
ck

You can use a Popup control for this. Just add your content to the popup and show it.

Tim Heuer has taken the ChildWindow code from the Silverlight Toolkit and refactored it to a modeless implementation. See:
http://silverlightfeeds.com/post/533/Refactoring_Silverlight_ChildWindow_for_a_non-modal_use.aspx

Related

How to close previous window when it redirects to another window in wpf mvvm using caliburn micro?

I am using caliburn micro in my project with mvvm architecure. I created on user control with a single button. when i click on the button it is redirecting to another user control. But the problem is when i redirect to another window, it is attaching to the previous window.
So, can any one help me to how to close the previous window when it redirects to another window.?
Thanks.
This is an old question, but the way I would go about solving this issue is use IoC/MEF to get a reference to the window manager, do a WindowManager.CreateWindow(NewViewModel) to open a new window, then TryClose() the old window.

WPF Displaying Windows

I have been looking for a good tutorial on WPF, MVVM and windows navigation. I am trying to display a new window once a user clicks an "ok" button. Does anyone know how to go about doing this?
To display a new window using an OK button, you need to create a new instance of the window and call it's Show() method. You can either do this in the button click event (code behind) or bind it to a custom Command object (MVVM). Here's the code to open a window.
var window = new MainWindow();
window.Show();
In MVVM, some developers choose to just have 1 Window, usually MainWindow, and separate parts of their UI into UserControls. They use DataTemplates to define which UserControl appears in the MainWindow.
There are a lot of tutorials on MVVM if you just take time to Google this topic. Here's a few links that have helped me a lot.
http://rachel53461.wordpress.com/2011/12/18/navigation-with-mvvm-2/
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

Modal dialog box with fading background?

In my WPF application, when there is no user activity for 2 minutes, the application logs off.
I need to show the login box in the silverlight style (Background fades off). How can this be accomplished in WPF?
Yes you are right using adorner you can do this.
there are many articles there.. try these
http://techiethings.blogspot.com/2009/12/web-style-wpf-popup.html
http://bignickolson.com/2009/10/15/overlaying-controls-in-wpf-with-adorners/
Regards.

Silverlight App inside WPF WebBrowser?

I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.

Display modal Silverlight popup on HTML button click

I have the following desired workflow: on HTML button click a Silverlight modal popup (dialog) must be displayed. No Silverlight content is displayed before HTML button click and no Silverlight content must be displayed after exiting from modal SL popup.
According to our customer inclination we couldn't use another technology for such popups.
Any thoughts on how to accomplish mentioned workflow?
I'm quite new to Silverlight so all the ideas are highly appreciated.
The requirement is a little unusual, but here goes...
I am assuming you have a Silverlight test project and know enough HTML/JScript to popup a window, as you tagged this question as Silverlight only.
Think of Silverlight as just another component you can put on a web page. Any web page. It can be a small control, or fill a HTML window.
In your case you want to simply put your Silverlight startup code into a html page that a popup window can show. The popup window will be triggered by JScript attached to a button.
The Silverlight startup code is usually generated for you in a HTML test webpage in your Silverlight Webproject. Copy it from there.
If you need more detailed instructions for a specific example, please provide more detail.

Resources