prism

What is the difference between register a region to adding a region in prism?

…衆ロ難τιáo~ 提交于 2019-12-21 17:12:16
问题 I want to create a region with dynamic views(multiple views in one region). The region content need to be changed by ComboBox selection event(the comobox items are view instances). I want that a change in the ComboBox will change the view in the region by the selected view item. My question what is the difference between : MyView view= new MyView(); IRegion region = new Region(); region.Name="MyRegion"; regionManager.Regions.Add(region); region.Add(view); region.Activate(view); To:

Creating objects using Unity Resolve with extra parameters

谁说我不能喝 提交于 2019-12-21 07:24:16
问题 I'm using Prism, which gives be the nice Unity IoC container too. I'm new to the concept, so I haven't gotten my hands all around it yet. What I want to do now is to create an object using the IoC container, but passing an extra parameter too. Allow me to explain with an example..: I have a class that takes a commands object. This is registered in the IoC container, so it will handle it nicely: public class Person { public Person(IApplicationCommands commands) { .. } .. } Person person =

WPF: Is Prism overkill for small apps?

末鹿安然 提交于 2019-12-21 07:15:08
问题 If I don't split my app into different modules (otherwise I would argue that Prism would defo be the way to go) should I use Prism? I know that Prism gives a convenient implementation of ICommand (which I could do myself in a page of code) and gives us the IEventAggregator but does all the Bootstrapper, Shell, ModuleCatalog stuff really help? Why not just use the MVVM pattern (without Prism) to separate out your concerns so your app is testable and Bob's your Uncle! 回答1: For a small

Prism, Regions, Magic strings and refactoring : am I missing something here?

浪尽此生 提交于 2019-12-21 06:06:13
问题 To build a composite application view in my application, with different regions, untill now, I've always used content presenter and used DataBinding to set its content. If I wanted to change its content, I would just have to use an event aggregator, publish a ViewZoneChangedEvent , subscribe to it in the "shell" window, and update the viewmodel accordingly so that the new data would be available for the binding and the UI be updated. Now, I recently came across those Regions in Prism,

WPF Prism Inject same viewmodel instance into two views

╄→尐↘猪︶ㄣ 提交于 2019-12-21 05:43:04
问题 So I have two separate views in a WPF Prism app. How can I inject the same instance of a ViewModel into both the views via Dependency Injection? 回答1: (I assume you are using Unity as you mentioned DI directly and are not saying "Import" or similar) Hi, You will have to register the ViewModel as a singleton (using a ContainerControlledLifetimeManager) in the container and have it injected as usual. This ensures that you will get the same instance whenever you request for it. A valid approach

Loading a prism module view from the shell, using MEF

南楼画角 提交于 2019-12-21 05:35:09
问题 I have a shell project which is loading modules in my bootstrapper into a tab control in my shell's main view. I have just implemented a close button on my tab items which now poses the question of how do I reload module views from the shell? Tried using moduleManager.LoadModule("ModuleA"); but this only works when the module is first loaded. When I call the above it loads and initializes the module, displaying the view. If I then close the view again, the 2nd time I try this it doesn't

How to dynamically discover all XAML files in all modules in a Silverlight prism app

…衆ロ難τιáo~ 提交于 2019-12-21 04:12:40
问题 Is there an easy way to dynamically discover all the XAMLs files within all the currently loaded modules (specifically of a Silverlight Prism application)? I am sure this is possible, but not sure where to start. This has to occur on the Silverlight client: We could of course parse the projects on the dev machine, but that would reduce the flexibility and would include unused files in the search. Basically we want to be able to parse all XAML files in a very large Prism project (independent

StockTrader RI > Controllers, Presenters, WTF?

狂风中的少年 提交于 2019-12-21 02:02:25
问题 I am currently learning how to make advanced usage of WPF via the Prism (Composite WPF) project. I watch many videos and examples and the demo application StockTraderRI makes me ask this question: What is the exact role of each of the following part? SomethingService: Ok, this is something to manage data SomethingView: Ok, this is what's displayed SomethingPresentationModel: Ok, this contains data and commands for the view to bind to (equivalent to a ViewModel). SomethingPresenter: I don't

In Composite WPF (Prism), what is the difference between IRegion.Add and IRegionManager.RegisterViewWithRegion?

我只是一个虾纸丫 提交于 2019-12-20 18:07:03
问题 In Composite WPF (Prism), when adding modules to the IRegionManger collection, what is the difference between using IRegion.Add and IRegionManager.RegisterViewWithRegion? IRegion.Add public void Initialize() { _regionManager.Regions["MainRegion"].Add( new ModuleAView() ); } IRegionManager.RegisterViewWithRegion public void Initialize() { _regionManager.RegisterViewWithRegion( "MainRegion", typeof( ModuleAView ) ); } 回答1: The difference is who is responsible for creating the view. In the

WPF + MvvM + Prism

痴心易碎 提交于 2019-12-20 17:18:21
问题 I am new in the Wpf & Mvvm world , but I have found a couple of examples and just found that there is some different way to instantiate the model. I would like to know the best/correct way to do it. both ways are using Unity What I've foud: var navigatorView = new MainView(); navigatorView.DataContext = m_Container.Resolve<INavigatorViewModel>(); m_RegionManager.Regions["NavigatorRegion"].Add(navigatorView); What I did: var navigatorView = m_Container.Resolve<MainView>; m_RegionManager