MUI - PRISM Integration

Sep 10, 2013 at 6:43 PM
Hi,

a few months ago I was discussing a PRISM integration with MUI in one of the other threads of this project. Since my first prototype that I have posted a few months ago, I have developed a (imho) stable integration that I would be happy to contribute.
There is a few internal classes (mainly the Link and related classes) of MUI that I conceptually duplicated in order to finish this. As I duplicated and extended some of the classes, I think we should discuss if you are willing to change their visibility from internal to public. This would enable my contribution to rely on the MUI standard classes instead of duplicates. I would then at least have a chance to inherit from them....I must confess that I did not think too much about that, but it works (imho) so amazingly great with the prism concepts, that you should at least spend some thoughts on this...

I "invented" kind of "ModernEmptyWindow" before it was available at codeplex, as it was crucial for my project. The Mui.Prism integration library is then very small... some mui duplicates, some prism region adapters for menu and tab is essentially everything.

There may be some other ways to perform the tasks that I did with a different approach. i would therefore be very happy if you tell me your preferred way of sharing my code so you can evaluate it and discuss it with me.

So far
Florian
Coordinator
Sep 10, 2013 at 7:29 PM
Sounds awesome! Definitely open to discuss changes to MUI if that helps extensibility. What internal classes/APIs are you talking about?

My PRISM experience is limited, but happy to look at what you created. Can you email your code in a ZIP? (see http://firstfloorsoftware.com/contact for contact details)

As far as publishing your code is concerned; I see two options, 1) add the Mui.Prism project to mui.codeplex.com, or 2) create a new open source contrib project for Mui.Prism. I'm not sure yet which option is best, suggestions are welcome. One thing I do know, is that MUI itself should only depend on the BCL, no other dependencies.
Sep 12, 2013 at 9:13 AM
This sounds like it could be really useful, I'm a big fan of MUI and I would be really interested in seeing how you have approached the PRISM integration in code once you guys decide how you are going to move forward
Sep 12, 2013 at 2:47 PM
I am currently preparing a sample application that will help in our discussion. As soon as I am finished, I'll zip it up and send you an email.
Nov 19, 2013 at 8:31 PM
I have prior experience with Prism and I stumbled on m:ui for a new application. I already evaluated m:ui by itself and so far I like what I see. I still am not sure at this time if I would go the Prism route again as I should be able to get away with MEF by itself just to load plugins. I would love to see the outcome of your work since it would help ...
Nov 24, 2013 at 2:09 PM
I was finally able to build a sample app together with mui and my mui:prism integration. I would be really happy if some of you could review it critically and give feedback on it.
There are a few points I am really unhappy with that I would like to tell you in advance:
  • I duplicated some parts of the mui classes and changed those so they fit better with my idea of prism integration.
  • The user-driven navigation (by clicking one of the links) and the programmatic navigation don't match to 100%. Search for a TODO that asks for better ideas and you will see what I mean.
  • The sample does not contain any sample demonstrating advanced navigation concepts available in Prism, like INavigationAware. It just shows the integration of mui and prism.
  • The bootstrapper has some minor flaws.
I hope some of you find it useful and have critical feedback for me. I also sent the sample to kozw, he's very busy at the moment and we will see, if and how this code can find its way to this project in some manner.

You can find the sample here.
Dec 26, 2013 at 12:37 PM
I am in the same situation as codedevote trying to get PRISM and mui married. and to complicate things further sprinkled with a some ReactiveUI.
I have a question that is a little of topic. How would you reference the mui styles in Module1 and Module 2 in your sample application?
Dec 27, 2013 at 10:26 AM
I am not sure what kind of style reference you mean, so I may miss the point. I'll try, nevertheless. Most of the mui styles are implicit for the built-in controls, so there's no need to set the styles explicitly. If you want to reference specific styles, e.g. TextBlock style "Title" or sth. similar, I would suggest you merge the resource dictionaries of mui in your app.xaml (as should be done in any mui app and in my sample as well) and reference the styles as dynamic resources, e.g.
<TextBlock Style="{DynamicResource Title"/>
Jan 22, 2014 at 11:46 AM
@codedevote

It's possible to make your sample to just register View but don't add to menu?
Jan 22, 2014 at 12:30 PM
@IkeCode

I don't know, if I understand your question completely. If not, please be more explicit and provide a sample use case.

Just registering views is something that PRISM provides OOTB. See the concepts of regions, view injection, view discovery and navigation in the PRISM docs.
My efforts with the mui integration was mainly motivated by integrating the menu and menu navigation. I am working on an application, where I use these menu navigation stuff from my sample (it has been refactored a little, but its effectively the same concepts) and standard PRISM mechanisms.
Jan 22, 2014 at 4:13 PM
@codedevote,

I want to know how to implement the navigation for 'mui:ModernTab', on app menu navigation was ok, but if i have the ModernTab inside my View i get Navigation Failed exception, for both "/Content/ViewName.xaml" and "content://linkName".

Can you help me with that?

Thanks!
Jan 22, 2014 at 4:35 PM
Have a look at the ModernTabRegionAdapter. I started to implement it, but did not finish it, as i didn't need it.
I can give you the idea of what I would do:
  • Define your ModernTab as a Prism region via attached property RegionManager.RegionName
  • In the bootstrapper, register the ModernTabRegionAdapter, if not done already.
  • If you now navigate to a view within the Moderntab region, the region adapter will be called.
  • In the region adapters Adapt method, subscribe to the CollectionChanged event of the region collection. When a item is added to the collection, this means you now have to take the view and adapt it to the ModernTab.
I am very busy right now, so I can't extend the sample at the moment. Give it a try, I will help you with ideas and comments as far as I find time for it.
Aug 5, 2014 at 4:57 PM
The latest code sample that is working can be found here. From the last sample to my latest efforts, it's not too much that changed. Maybe some minor tweaks, but in the end, you should be good to go with what I linked. I am planning to contribute my latest version, but unfortunately at the moment I am too busy. If you have questions regarding the code, feel free to post them. I will answer as I find the time.
Feb 27, 2015 at 6:52 AM
Great job,I like it. even though I just begin to develop with prism .
Is there a new message for the demo? it's pity I can't access the google driver.