Overlay two Silverlight apps - silverlight

I was wondering if it is possible to have two Silverlight apps overlway each other.
What I would like to do is have SilverlightApp1 take the whole browser window, then SilverlightApp2 show up as a popup in center of window as modal with transparent background. SilverlightApp2 would take up all window space too (to act as modal and block access to SilverlightApp1), but since the background is transparent it would act as modal and only have the main container element accessible.
Is this possible?
I was kind able to achieve this but not the transparency part of it...
I know there are easier solutions for this, but I am working inside an existing Silverlight application (which is SilverlightApp1 above) where I don't have the ability to modify much, but the HTML containing the app.
Thank you!

You could try to make a modal javascript window which overlays the div of SilverlightApp1 and place SilverlightApp2 on it. Maybe you should make SilverlightApp2 not to take up all window space and make the transparent/modal part with a div.
I think this could work.

Related

Force visual layout of hidden tab content

I have some quite complex content behind several tabs. I'd like to force the layout to happen at application startup rather than lazily as the user clicks a tab for the first time. The delay is about a second or two per tab, and it's a bit embarrassing!
Edit: I think the problem is that only the selected tab's content control is in the visual tree. Calling ApplyTemplate of the HeaderedContentControl didn't make any difference.
Does this link help you?
wpf force to build visual tree
Basically it says to use ApplyTemplate on the ItemsControl...I guess that for the tabs you should do it for each TabItem.
There's also another technique used in this site:
http://xcalibur37.wordpress.com/2012/07/12/make-your-tabcontrol-preload-in-wpf-silverlight/
Here he creates a kind of preloader for each tab. It's for silverlight but I think it can be applied to WPF.
Hope it helps out :)

Winforms - how to create something similar to a master page?

I'm trying to build an app in winforms with something similiar to masterpages in asp.net - a menu on top and when choosing an option from the menu the entire screen on the bottom will change while the menu remains (there are 10-15 screens in the future app, some are quite similar, some are not).
What is the best way of doing this? Should I use different forms for each screen or use a panel or something else?
If I use a panel or something how do I manage to use the designer with so many panels taking space on the screen?
Try with the MDIParent Form's. View the Example
http://www.codeproject.com/Articles/12514/Multi-Document-Interface-MDI-tab-page-browsing-wit
If it is just keeping the same menu and opening/closing parts of the UI you could simply add and remove instances of usercontrols to the main form.
If you need more features such as docking (like Visual Studio) look at this
Another option is to use Form inheritance
Which one to select depends on what you want to reuse and the features you need.
One option would be to make your application an MDI window and then load entire forms, maximized, into the parent window.
Then, you would be able to treat each form as its own self-contained item, since it really would be exactly that.
Is it not an option for you to use WPF? A WPF browser application fits the paradigm you are describing quite well.

Is there a SurfacePopup control in Surface 2?

We've been working on an application for the last few months that's aimed at Windows 7 tablet PCs. So we've used the Surface 2 SDK for most controls and it's all touch-happy.
I have noticed recently, though, that one of our custom controls isn't working as it should. This control provides popout menus, and these are achieved through the Popup control. On a developer's laptop, this works fine and the menus vanish when you click away from them. I've noticed, though, that on our test tablet they have a tendency to stay open.
I found that there was a SurfacePopup in the first Surface SDK, but I can't find one in the Surface 2 SDK. Did they get rid of it? Is there a 'best practice' approach?
If there's no simple solution, I may have to go old-school and add a window-sized hidden SurfaceButton below the menu when it appears, that hides itself and the menu when clicked or touched.
Beyond that I've noticed that sometimes the SurfaceScrollViewer within the popups won't work. I'm guessing this is because it's not picking up touch events properly. I tried adding this extension method to the window..
this.EnableSurfaceInput();
..but I get a NullReferenceException on System.Windows.Input.Mouse.get_LeftButton() which bizarrely suggests that it can only enable surface inputs for controls when there's a mouse plugged in.
Any ideas? They'll all be welcomed with open arms!
There's no SurfacePopup in the Surface SDK 2.0, however you can use a normal WPF popup. Then you need to make sure that it receives Touch Events by using the extension method you suggested above on the popup, not the window:
((HwndSource)HwndSource.FromVisual(popup)).EnableSurfaceInput();
Edit: As I just found out, this only works when the popup is initially open. To get it to work when the popup is opened later on, you don't need to use the popup, but the parent of it's child (see this question).
For the benefit of Daniel, and anyone else who needs a solution to this, I'll try to cast my mind back two years and explain how we got this working.
As far as I can remember, the answer was to use an adorner layer instead of a popup. Basically, every WPF control has an adorner layer, which sits above the control's UI stack. By default it contains nothing, but you can add whatever you like to it.
I got this all working by writing a custom control that allows you to place that control, with content, in the XAML and then show and hide it whenever you need to. When it's shown, it moves its contents into the adorner layer of the containing window, and when it's hidden it moves the contents back into the control itself, which is hidden from the user.
Afraid I can't go into any more detail than that, but as far as I can remember this was the ultimate solution; replacing popups (which never quite worked very well) with a custom control that uses the adorner layer.
Hope that helps!

WPF UI detach(pin out) functionality

Am looking to implement a detach and popup UI behaviour in my applcation.
It basically means that I will be displaying say, a stackpanel with lot elements on the right side of my page. And on a button click, I want the stackpanel part to popup(removing its allocated space in the UI) and should be able to move it above the underlying wpf UI.
What am trying to do is that remove the stackpanel from its parent grid on button click and add it as the child of wpf popup control. But I am facing some issues doing this way. However I just want to know whether I am doing it in the correct way or do anyone have a good alternative for implementing this pin out functionality am specified here?
Thanks,
Vinsdeon
How about using this kinda nice control, AvalonDock, which is simulating Visual Studio's dockable components behaviors?
http://avalondock.codeplex.com/
It will spare you the pain of developing such a specific functionality, and will have a great reusability anyway

Silverlight dropdown menu in a html page?

I'm not too familiar with silverlight, so I'm pretty sure I am asking a basic question.
Is it possible to have a silverlight dropdown menu (like superfish, or so-called dhtml menus) in a web page that will ;
not use more space in the page than
the first level
will go over html content when we
expand it.
I guess that Silverlight has to be displayed inside a certain "canvas" like flash, so the silverlight menu has to be either :
as big as the fully expanded menu can
be -- with the possibility to display
html over it (using css?) and make
sure that the expanded items goes on
top of html ==> That seems not really
easy!
as small as the first level of menu
items -- means that silverlight has
to get out of the canvas to display
menu items ==> Is that even possible?
I know that this may sound ridiculous, but the project is to modernize the portal around sql server reporting services using silverlight in a sharepoint webpart. There's no possibility to change the setup, I just want to know if that could be achieved using silverlight. If it can't, we will fall back to superfish.
Thanks!
It is possible. Silverlight plugin should be set to windowless, so its content can overlap with html. Because Silverlight can not draw outside of its own surface you would have to make as large as biggest menu element or you could resize Silverlight container dynamically through javascript bridge.

Resources