I'm new to Prism and have a conceptual question.
What I want to build is a Silverlight app that can load its layout (and the modules that are used) from a config file. Imagine I have a number of modules (e.g. a Chart, a Treeview and a Newsticker) and I want to use my config file to determine which of those are visible in my app and also where they are located on screen.
So if I want to have an app with just a Graph and a Treeview but not a Newsticker, would it be enough to just create an XAML file that contains views to those two modules? Would this XAML file be the shell?
Could I then have different XAML files/shells/config files to "generate" different looking applications at startup?
I don't need to switch layouts at runtime, I just want to be able to easily configure my application to use a different set of modules. I would appreciate pointers in the right direction.
Here are some approaches that I found:
http://blog.roundthecampfire.net/2011/10/creating-composable-ui-with-f-and-prism.html
http://www.dotnetpatterns.net/content/147-Lesson-2-Prism-creating-a-dynamic-region-layout-with-templates
Related
Is there a way to create a product (Software) divided in modules?
What I mean is for example create an application using WPF that is divided in 3 modules (in the future they may be more) Main Module, Module 1, Module 2
Each module could be a standalone solution. Each of them with presentation, Business and Data access layers.
From the Main Module when a button is clicked, it will call any other module for example module 1 but the UI of the module should be seen like if it were from the main Module.
I have manage to use MEF to separate project building but I don now how to use MEF with WPF
Any Starting point or suggestion?
Putting your business and data access layers in a MEF module is fairly straightforward and accomplished as you would for any other project, the trick with WPF is adding the view resources. That can be done by putting them in a ResourceDictionary decorated with the Export attribute and merged into the global dictionary, as shown in the answer to "How to provide XAML resources from MEF components".
Can we have Unity configuration in file other than app.config file of the application? If yes, how to do it?
Can we combine unity configuration spread across multiple files?
How to define Unity configuration in the XAML file? (PRISM modules can be configured in XAML.)
Is it possible to have custom implementation of the Microsoft.Practices.Unity.Configuration.UnityConfigurationSection configuration reader class?
We are developing a WPF application which should allow other developers (working on various ares of the enterprise app) to register their XAML views (user controls) with our application. And depending on the functionality being used, our product will navigate user to the appropriate form/view. E.g. On click of the "Home" button, user would be navigated to the "Dashboard". But Dashboard may or may not be developed by the core product.
I am using Prism 4.1.
I believe that pretty much everything you need is explained in the following section of Unity's documentation:
Using Design-Time Configuration
It describes how to load one or several "configurations" into a Unity container from the default configuration file or from several other independent files.
Based on this, I believe you should be able to have a configuration file in each of your modules and load them manually in the Initialize method (or the module classes' constructors). If not, you can always register the corresponding type mappings programatically in the modules too.
I've learned from THIS question that Skins, Containers and Modules are ASCX files but they weren't explained well. What are the differences of the these ASCX files?
Containers are "styling" for modules, but mainly just think of them as a Wrapper.
Modules provide Content and Functionality on your DNN website. The simplest way to think of a container, is to draw a box around the Content/Functionality in a module, that is your container.
If you notice the "careers 2.0" section of Stack Overflow on the right side of this page, the Careers 2.0" area at the top would be the module's title, while the list of jobs inside of that box would be the content provided by the module itself.
The skin provides the layout for a page. It will have sections to which modules can be added, called panes (e.g. ContentPane, LeftPane, HeaderPane, etc.).
Skins and containers are design elements, whereas modules provide functionality.
I'm trying to figure out what would be best solution to the problem I'm facing. I have a Silverlight application which should be composed from different modules. I can use Prism, place regions and load modules and fill regions with loaded modules but this is not enough in my situation. Here's what I want to accomplish:
For most views that gets loaded from different xap files, I should place an element somewhere in the shell, which will perform navigation to the dynamically loaded view.
That element (which links to dynamically loaded view) should support localization and should have dynamically assignable data templates, different module links should have different content/data template (I'm thinking writing data templates in xaml files on the server and reading them from silverlight via XamlReader, maybe there's a better way?).
Uri mapping and browser journal should work with navigation. Silverlight default navigation mechanism better suits my needs than the one found in Prism.
The architecture should support MVVM.
I think thats all. I just couldn't think of a good architecture which will satisfy all my needs. Any help would be greatly appreciated.
I do not know of a single product/solution that would cover all your requirements, so here are some comments on each:
If one area of the shell has a region that supports multiple items, you just register a control of type link/button etc with the same region name in each module. For example we register views based on the Telerik TadRibbonTab (instead of UserControl) with a region named "views" which is a RibbonBarTab with a region named "views". Every module then adds its its own button to the list. You can do the same thing with any multi-item container.
Localisation is a completely different issue and can be solved in a number of ways. See my answer here: Load Resources ".resx" from folder in Silverlight
A custom navigation mapper can be made to behave like the standard one, without messing up the support for Prism regions. The one we created encodes GUI information such as current selections (current view and item selections etc) into the URL. That means we are in total control of the state and the URL controls the state.
Hardly anything stops you using MVVM as that is one small feature for separating views from code-behind data.
I will be interested in what other solutions are proposed as we are always looking for new ideas too.
We have a legacy application that utilizes VB6, the Flash ActiveX control, and Flash content to display animated movies to users. For plenty of reasons we're looking to migrate away from this. I'm hoping someone out there can answer a few questions about WPF so that we can make a determination about how best to move forward.
First, a little about our current architecture and needs. The Flash content is set up as separate SWF files, where each individual SWF represents a training module with animated content. We have hundreds of these modules. Users run this software in a disconnected fashion where their local machine may or may not have ALL of these SWF files. The current application gives the user the option of downloading the SWF modules as they're needed.
Here's how we're thinking about setting up a new solution using WPF and Blend. We've written a WPF host application that can dynamically show Blend content based on button presses or whatever. And we've created a few test modules in Blend as WPF custom controls. But there are three nagging questions:
Right now we have the custom controls within the main WPF solution, but we need to make these disconnected. I've read several things about using Application.LoadComponent but I don't know if that will work for our solution.
Each of the Blend custom controls contains one or more storyboards that control the animation. As soon as I add one of the custom controls to a container in the WPF app, ALL of the storyboards automatically start "playing". How can I programatically make it so that I start/stop certain storyboards as needed?
Let's say I want to change a text label in one of the custom controls. If we're dynamically loading the custom control, how would I access one of the text labels to make such a change?
Any tips would be greatly appreciated. Loving WPF so far and hoping we can make this work and say goodbye to Flash forever!!!
There is Manage Extensibility Framework, that is a standard approach for dynamic modules.
Anyway, I haven't used it, so I would answer the questions in other way:
1) No, LoadComponent is ised for xaml files, whereas custom control consist of code and xaml. I mean, the custom control that you can add using Add->New Item->Custom Control(WPF). So you should do something like this, with reflection and ContentControl:
Assembly asm = Assembly.LoadFile(#"C:\SomeLibrary.dll");
Type type = asm.GetType("SomeNamespace.SomeControl");
var control = Activator.CreateInstance(type) as Control;
this.myContentControl.Content = control;
2) It isn't fact. You can put the storyboards into Control.Resources and launch them manually.
((Storyboard)control.Resources["myStoryboard"]).Begin(control);
3)
control.FindName("anyname") as TextBlock;