I am starting on a new project in WPF with MVVM. As per the Microsoft recommendations, it is advisable to use PRISM for various reasons.
Project requirements:
Dynamic menu with menubar based on roles assigned to user (fetched from database)
Toolbar for commonly used menu items and functionalities (again role based)
Status bar to display general broadcast messages and other information.
Single middle view to load screens as menu items are clicked.
Can someone guide me to a working sample (mainly dynamic menu and multiple views loading in the main region) in this regard.
If you're starting a new project, you might as well consider the latest version of Prism (v6). You can find the official samples for this version on GitHub, together with extensive documentation on how to use Prism with WPF. I suggest you go through these first.
As for the role based menu items, that's something too specific to find any samples on, but it basically comes down to correctly apply authorization and the necessary filtering of your menu items.
Related
Well ... at the risk of sounding like I really don't know anything about programming, I have a question about controls in Silverlight 5.
I have an OOB App that I am working with, but I need to add the User Menus (File, Edit, etc.) that are normally seen at the top of all apps. There used to be a control in VS (the Menu control) that was easily configurable. What is the control used to create the User Menus in Silverlight 5? The Context Menu is not what I am asking about. That is the right mouse click menu ... so that's not the answer ...
Please, understand my problem. It's been since Silverlight 2 since I worked in Silverlight. I appreciate any information you kind folks would be willing to provide.
There is no such thing available directly from Microsoft (meaning it's neither built-in or present in the Silverlight Toolkit).
You will have to use third-party controls such as DevExpress or Telerik.
EDIT: Some more advice in response to your comment.
Another possibility is to create UIs from scratch. There are two forms of UIs that I found inspiring lately, both of which don't use any ribbons or drop-down menues at all. The first is to use "Windows 8"-like dashboards instead of traditional menues, the other is the Windows Azure Management Portal (a web application).
I don't use traditional UI frameworks for menues myself, but mostly because I don't like those approaches and I'm picky with how user interfaces should work and look like.
But obviously you have to make a serious time investment to go new ways. And it will heavily depend on your application what approach makes sense.
Here's one simple approach that could work in a number of cases, I used it for a database application (I call it the Windows-Phone-7/8 approach):
The screen is divided into the "page" area and information bars. The information bars contain no menues, just who's logged on, a back-button, a home-button, and context-sensitive buttons depending on what's in the view. So basically it behaves like a web browser and you navigate through the app by clicking on "links" (buttons that take you elsewhere).
There's only one page area, so no windows and no popups. I've gone to the extreme of making even dialog windows to be pages.
Now you need menues. You do that with "dashboards", ie. pages that present some overview stuff and buttons that lead to the other areas of your application.
Although you could have action buttons like save or delete on the page itself, I put them in the bottom bar (but they are still dependent on the page your on) - that is exactly how it works in Windows Phone 7/8.
One last advice: The real effort is usually not in the menus anyway. Beside your application logic itself, it's a lot of little things like login screen, error handling and how to present error messages (look at the windows azure management portal for how they did that really nicely) and gracefully failing on session timeout. There's also a lot of nuisance on how you manage your data (ria-services, etc.).
So as long as you don't need fancy data grid grouping, rich-text edit or excel-like pivot controls, a toolkit might not help you as much as you'd hope - because they give you only the controls, not the entire UI.
We are trying to evaluate extjs 4.x with Sencha Architect v2.x (UI designer) for our in-house sales tracking system. We are able to design and develop each/single modules like user manager, item manager etc as an application for using designer.
However, in order to make entire application work - driven by menu or dashboard and opening each module/application in separate tab, we are not able to make out the appropriate approach. Are we expected to design entire application in single design file which I believe is not practical as we would have more than 50 modules and many UIs.
We want to have something like we have dashboard with tree menu on left and tabs opening on right. On menu click we create a tab (if it does not already added) and open application that was originally designed with designer. E.g. if user clicks on “Sales order” we open sales order tab and so on.
We wanted make sure that we do use designer with model, store. I would appreciate suggestion on reusability of components like models, stores etc.
Ref: http://blog.dnet-ebusiness-suite.com/2012/04/sales-order-to-invoice-and-delivery.html
Architect 2 does not have a single design file. In fact each class has it's own file. You would not need to have separate projects. In fact both the metadata and the source Architect produces is very source control friendly.
How to pick a certain ribbon to show?
I have a Silverlight webresource inserted across the whole page and I want to show a ribbon of certain entity for it.
I suppose it's possible to do it by calling some javascript from XRM library? But I didn't find anything till now.
Thank you
You might be thinking about this backwards. You don't use JavaScript to pick ribbon to show. You set up ribbon anywhere it could show (using RibbonDiffXml) and then EnableRules and DisplayRules to control where it shows. Enable Rules allow you to specify web resources and use JavaScript to control whether the button is enabled. Unfortunately, CRM won't allow you to use JavaScript to control whether it displays (fingers crossed for future availability).
There are lots of examples out there. Here is one and two I just googled up. Be sure to reference the SDK for all the rules. Finally, if you want to short-cut learning some of the schema, you can use the Visual Ribbon Editor tool.
Note that you can either specify your ribbon customizations to a particular entity (in its RibbonDiffXml subnode) or in the global scope (exporting Ribbon Client Extensions) and use the {!EntityLogicalname} in the Id fields so CRM will generate a unique ID for the node, per entity, when it 'expands' the definition.
I am writing my first wpf application now .
I want to use a NavigationWindow on each page the user make selections and all the data should be available on the next pages, I have about 6 page.
How I should path all the data ? via the constructor ? or there is some smarter way in WPF .
On the last page there will be a lot data to path from the previous pages.
I would attack this from one of two ways: The Code-behind way (Easy, but difficult to expand, also will get very messy), and the MVVM way (Takes some learning, separates concerns, easy to extend, manage).
In the code-behind way, I would just have a Tab control with the tab headers styled the way you want them (you can style them to look like just about anything you want). In the code-behind you could have some logic that specifies that X Tab is not enabled or Visible until Y criteria are met.
There is a better way, but it comes with a bit of a learning curve, the MVVM design pattern. You would have 6 Page objects that are really just CLR objects that define the contents of the page (e.g. if it is a questionnaire your page objects would contain question objects and title objects for instance).
You could have a couple of Views, a navigation View, and a page view. The NavigationView would be bound to a NavigationViewModel which would have the logic necessary to change the page. The PageView would be bound to one of 6 PageViewModels and the PageViews DataContext (which provides that binding) could be changed based on the NavigationViews logic.
Learning Prism composite application guidance for WPF Silverlight MVVM Fundamentals
MSDN Page for MVVM explanation
Night Walker,
It is difficult to make out exactly what you want to do from your explanation. First, the NavigationWindow is the frame of your application, I think you know this but I just wanted to make sure we understood that we're not creating new instances of the NavigationWindow. I think you mean 'Pages'. Pages are the content of a Navigation window and represent some target that you want to appear in the ContentPresenter that is provided by the NavigationWindow.
I'm again not sure how you are using the phrase 'Path the data'. Typically you would create Pages either directly in the project or in satellite projects and then reference them using Pack URIs. An example of how Pack URIs are constructed can be found here.
http://msdn.microsoft.com/en-us/library/aa970069(v=vs.85).aspx
You can then navigate to the pack URLs using an expression that looks like:
this.Navigate(new Uri("pack://application:,,,/MyAssembly;component/MyPage.xaml", UriKind.Absolute);
If you don't want to get involved with all the nuts-and-bolts of the framework for navigation and just want to focus on the application for your users, you can check out the professional version of the NavigationControl that I put together:
http://www.teraque.com/products/explorer-chrome-suite/
There's an free demo you can download. If this is was you are looking to do I can give you pointers if you don't want to purchase the package directly.
Sincerely,
Donald Roy Airey
donald.roy.airey#teraque.com
I come from mainly a web development background (ASP.NET, ASP.NET MVC, XHTML, CSS etc) but have been tasked with creating/designing a Silverlight application. The application is utilising Bing Maps control for Silverlight, this will be contained in a user control and will be the 'main' screen in the system.
There will be numerous other user controls on the form that will be used to choose/filter/sort/order the data on the map. I think of it like Visual Studio: the Bing Maps will be like the code editor window and the other controls will be like Solutions Explorer, Find Results etc. (although a lot less of them!)
I have read up and I'm comfortable with the data side (RIA-Services) of the application. I've (kinda) got my head around databinding and using a view model to present data and keep the code behind file lite.
What I do need some help on is UI design/navigation framework, specifically 2 aspects:
How do I best implement a fluid design so that the various user controls which filter the map data can be resized/pinned/unpinned (for example, like the Solution Explorer in VS)? I made a test using a Grid with a GridSplitter control, is this the best way? Would it be best to create a Grid/Gridsplitter with Navigation Frames inside the grid to load the content?
Since I have multiple user controls that basically use the same set of data, should I set the dataContext at the highest possible level (e.g. if using a grid with multiple frames, at the Grid level?).
Any help, tips, links etc. will be very much appreciated!
Microsoft has created a great community site for helping people get started with both design and Silverlight here: http://www.microsoft.com/design/toolbox/
It may be far more than what you need for your current project, but it definitely will give you the training you need to master Design with Silverlight.