How get XAP name from Silverlight application with MEF? - silverlight

I am writing Silverlight 4 application with Navigation framework and MEF.
In my application each menu for navigation must load on MEF project and show it.
But there are some problems. First of all I can't navigate to page of other XAP(see David Polls post). To do that I need DynamicNavigation.dll and must create extra pages, which is not acceptable in my case. Other soluction can be found on davidezordan.net. This version is looks much better.
Second problem for me is that example works great if there is on additional XAP, but if I load 2 or more XAPs(by clicking on menus for navigation), I can't decide which page to show.
If 2 XAPs are loaded MEFModuleList contains 2 pages and I can't get any information about them to decide which page to show.
One solution is to hard code XAP name of each project in pages, which will be loaded to MEFModuleList by Attribute or other way, but it is not good solution.
Is there any other way to solve this problem?

Related

How to generate .xap files in silverlight

I have a silverlight application with 2 pages, first is "animation" and second is "transformation"
first page works well, but second display nothing and i think the problem is: i don't have any transformation.xap. I only have have the animation.xap in my "clientBin" data for some reason
So here is my question: can i generate a .xap file for my transformation page so it can works?
Both pages are stored withing the same Silverlight application.
If you want to switch between pages you'll need to either:
Create another project that contains the transformation page and
redirect the browser to the page hosting it
Switch pages by setting the application's RootVisual to the page you want displayed

Embed another xaml silverlight object in page

I am totally to Silverlight and am Getting started. I finished the first of the Getting started series here and now seeing into HTML Bridge now over here. Visual Studio created a website for me when it created the new silverlight application. For the HTML bridge tutorial I created another silverlight page(Is this what i should create) and put some code into it.
Question
How do I embed this into a html page? ( I know how to do it using markup as well as javascript, I am confused as to how to get the application out of single xap file inside ClientBin directory)
With Silverlight you are dealing with a single plugin within a HTML page. That plugin is the single XAP file that the HTML page downloads.
Your Silverlight app may also have many pages, but its navigation is not the same as HTML navigation (it uses bookmark URLs to fool the browser into staying on the same page while it changes content). There is only the one HTML page involved.
Initially, just to test your new page, you can change the app.xaml.cs file to create your new Silverlight Page instead of RootVisual = new Main() etc. Long term you need one Silverlight application per separate plugin your require.
Update (from comments):
Pages in Silverlight are changed by substituting a visual element of the single main page with the contents of another Silverlight page.
You cannot simply replace the RootVisual (as that can only be set at startup).
Start with a new Navigation or Business application project to see the basics (navigation adds a lot of complexity, but once you see how it works it is pretty cool).

Is it possible to reference a masterpage in an MVC ASCX control

I have an ASCX control that has to render Silverlight dynamically. The dynamic code works in a non-MVC environment, however when I try to load the silverlight into an MVC ASCX, I get a ScriptManager error. However, my main aspx page does reference the masterpage, which has a script manager. I just need the control to realize that there will be a scriptmanager once it is plugged into the main page. I am trying to use a ScriptManagerProxy, but it is still looking for the ScriptManager. So, I think my biggest problem is getting the control to recognize the masterpage from the main page. Hopefully this explains my problem properly. If you need any code snippets, I can provide them
I don't think you should be using ScriptManager with MVC. ScriptManager is for Web Forms. There is a 3rd party one for MVC http://mvcscriptmanager.codeplex.com/.
I don't know that I quite understand what you are trying to accomplish. But you can use an IFrame (yuck) in your MVC page to display an aspx page.

dotnetnuke: can we create a master page?

Can we create a content managed master page in dotnetnuke?
eg. I want the right pane and bottom pane to be content managed, but to show the same thing across all pages.
Thanks
What you are describing is essentially what DNN calls a Skin.
A DNN skin is actually just an ASP.NET user control (ascx) that dictates page-wide or site-wide look and feel, which offers developers the same functionality as a Master page, except that it ties into DNN-specific elements and uses some DNN-specific user controls, such as menu/navigation, logo, breadcrumbs, login/user account links, etc.
Now, in order to add the ability to provide content management capabilities site-wide, you specify an area in your skin to place a module (let's say, a Text/HTML module). This area is called a pane. Once you add a module to this pane, in its settings you can tell it to appear on every page. This way, the module can be edited on any page, and its changes will be reflected on all pages automatically.
Check out DNN's site, as it contains a TON of documentation on how to do many common tasks: http://www.dotnetnuke.com/Support/Documentation/DownloadableFiles/tabid/478/Default.aspx. Under the Technical Documentation section, you'll want to grab the Skinning document (I believe it's a PDF).
DNN Modules can be set to appear on all pages by checking a checkbox in the module settings. However DNN does not use the concept of a Master Page. It injects modules (user controls) in containers on a single aspx page at runtime.
A Master Page would be a great addition to DotNetNuke you cannot replace content in a single area of the page. The whole page refreshes. For example if you have a menu and you only want the content of what you select to appear in a specific content area without refreshing the rest of the page you have to resort to third party modules that attempt to do that but usually fail. There are 'module wrappers' but all the ones I've tested have issues with modules that allow the user to edit content. Edit screens are usualy different user control files (ascx) that are launched when you edit the module content. Since the page refreshes with the new page you have lost your place. Those module wrappers work fine for static content and some other controls but not for all controls.
IFrames can be used (DNN has one) to trade out content but that doesn't get rid of the probelms mentione above. I'm heavily invested in DNN, running the UCanUse.com web site so this isn't a slam on DNN. I just thought I'd try to answer the quesiton with detail.

Is there a "Browser Control" to host a website inside Flash/Silverlight?

I'm looking for something similar to the VB6 / .Net Winforms "Browser Control", that let's you show a browser inside your application.
I don't want to just render a page, I want it to be a fully-functional browser, in which people can click links, will run Javascript, etc.
In essence, what I want is an IFrame, only that it runs inside a Flash app, or a Silverlight app.
The ultimate reason for this is that I want to defeat IFrame busters. I'm making a web app that lets you see other sites inside of it, and I'm running into a bunch of sites that have this code:
var t=top.location,w=window.location;if(t!=w) t.replace(w);
(that's from eBay BTW)
which essentially pops the user out of my site and into theirs.
My hope is that by using a "browser control" of some sort, inside a plugin sandbox, "top", will be top for that browser control, and not for my site.
Of course, if you have any other ideas to achieve the same, they'll be more than welcome.
Edit: I've tried the Component One control suggested by Bill, but it didn't work for these purposes, because it's creating an IFrame outside of the SilverLight control, so it executes in the same context as the page hosting Silverlight, which is what I'm trying to avoid.
Northcode SWF Studio allows you to add browser window on the stage in Flash. I personally use SWF Studio as a third party SWF2EXE tool to extend the power of Flash projectors. It's quite stable and powerful. As far as browser control is concerned here is the example you can download and test if it serves your purpose. Check the Browser APT here.
We've not built a component to enable folks to do this but we're open to suggestions here. That being said, easiest solution is an iFrame, but word of caution in that when you overlay an iFrame over the the top of Silverlight we've seen customers experience perf issues as a result (mostly due to alpha transparency of the iframe etc).
This isn't isolated to Silverlight, Flash suffers the same issue as it has to do with browsers and rendering within the given operating system.
HTH.
Scott Barnes / Rich Platforms Product Manager / Microsoft.
I use the HTML control created by Component One. It has the limitation that the Silverlight object in the page should be set to windowless, but otherwise it works very well.
It's an old post but I'll add my tupence answer. I used the DivElements free control for Silverlight link text and it works quite nicely. It just positions the div accurately so that it looks like it's on top.
As for the other such controls, you've got to set the windowless property of the Silverlight container to true.
It works really well for me and I'm able to seemlessly have Google maps and the Acrobat plugin displayed side by side with my Silverlight application.
PS: because the component just adds a <div> to the page, you can't do stuff like having it load dynamically Javascript file like in the <header> tag.
PPS: when setting the HTML code "by hand", be sure to hook up on the DocumentReady or Loaded event before playing with the HTML DOM.
Hope that helps someone.

Resources