Winforms application menu and application UI - winforms

I am working on a little WinForm app and have been trying to find the answers to a few questions i have without any luck. Im a ASP.NET developer so WinForms development is new to me.
Here is my main question:
How do I create a menu system that once selected the contents will render in the Main form of the selected item. If its a GridView I want to the GridView to render inside the main application so they can navigate away without having to deal with the modal popup. I do not want to popup forms unless i explicitly say so. I guess the equivalent to this would be using a Master page in ASP.NET.
Make sense?

The closest thing to Master pages in winforms would be MDI (multiple document interface), which is a hideous Windows 3.1-era abortion of a user interface. Why this option is even still around, and why anyone still uses it, is beyond me.
The second closest thing (and something more acceptable as a UI) is just to have one main form in your application, and implement the different pieces of functionality your app requires as separate user controls which are displayed on the form and hidden as the context requires.
A weirder method, but one that might also work for you, is to use forms inheritance - design one "master" form with the menus and controls that you want to always be present, and then have each form in your app inherit from that master form. This would not appear to the user to be much different from my second option above, so I wouldn't bother with it.

There really isn't anything similar to Master pages in WinForms.
The closest to what you want to use would be a TabControl selecting a different tab will display that tab over the other tabs. If you don't like the tab look you could extend the TabControl to not show the tabs or hack it together by placing the TabControl inside a panel just large enough to show the content but not the Tabs and change tabs programatically in your menu control.

Related

WPF dynamic content tabs NOT suitable substitute for MDI user interface

So I have this old PowerBuilder MDI application (medium enterprise app with about 40 windows), and I'm embarking on designing my very first WPF MVVM C# application to replace the aging PowerBuilder app. I've got plenty of C# & .NET experience, but this is my first WPF & MVVM app.
After reading many forum postings after searching for WPF & MDI alternative, I've come to the conclusion that the MDI isn't supported, and that the most commonly proposed substitute is to use the TabControl and dynamically generate the content of each tab page upon demand using a WPF User Control. I had initially been sold on this, and was actually excited by my initial prototype interface with a tabbed Ribbon bar at the top of the app, and the TabControl with the tabs of the app underneath that. However, I have hit a BIG brick wall.
Take a look at the following screen shot of one of the central multi-tab windows from my old application: http://www.creativedatatech.com/downloads/screenshot.jpg
As you can see, the app has a toolbar across the top and the left side, and the example MDI child window (Case Edit Window) that is open has a LOT of tab pages (18 of them), and the users really like being able to quickly click on a tab page to get directly to that information to work on it. Moreover, the users have grown accustomed to being able to open multiple Cases at once and either put them side by side (large monitors), or flip back and forth, possibly copying & pasting between them.
The problem here is that I cannot envision how I am going to incorporate all this multi-tab user experience for the Case Edit Window into a single tab of the top level WPF TabControl. Will the users end up seeing a row of tabs for the WPF TabControl, with one tab for each Case Edit Window that is open, and then inside each "Case Edit" tab page, a further nested set of 18 tab pages?? This seems confusing and a big mess of nested tabs. Add to that the tabs of the Ribbon control at the top of the app, and I think my users will be running after me to lynch me!
After investing two straight weeks reading up on WPF and MVVM, I am left with the sinking feeling that WPF really isn't going to fly well for enterprise apps such as mine.
Surely this can't be true! Does anyone have any comments on how I should go about shaping this app to accomplish what I'm trying to do here? I've already looked at WPF "pages", but I can't have the users serially navigate through all the individual pages to get to the content that they need to work on, and they need to be able to quickly (and visually) navigate to the Case Edit Window content that they need.
I think your problem is not so much WPF, but rather that GUI paradigms have moved away from the MDI that your current app uses. There is nothing stopping you implementing MDI in WPF, but what would be the point if your app ends up looking like it does now?
You really need to think about how to layout your app in a modern way. Perhaps you could keep your tabs for the different cases, but replace the multiple tabs in each child window with a master/detail view, much like Dev Studio does for its Options dialog?
We had this same dilemma, we decided on screen tabs at the bottom with tabs that relate to that screen at the top - and contextual ribbon items.
The tabs in the screens actually just scroll the window to the desired point so all information is sectioned off and available on each screen by scrolling or clicking the tab at the top.
Looks like this

Winforms design advice

I am working on a winforms client server application that will load one of many forms that would be used to enter data or retrieve data or search for data. I want to put buttons on the left side of the screen to select which form is loaded on the right, and buttons at the top for the usual New, Open, delete etc.
I began working on this by making an MDI form that would popup a child window that allows to user to pick the application they want to use. Then when they select it, it would load the appropriate form on the right and update the text and functions of the buttons on the left. I was using panels to load the forms into for the button form (which I called the Navigator) and the application form. I had to use events to make changes to the different button forms when the form on the right was changed. A friend of mine said that I was probably going about this in the wrong way. He said there is probably a better design pattern or methodology or controls that already do that for me.
I dont know how to even search for something like this on the web.
Can someone give me some direction on this?
I can do the research if I am pointed in the right direction.
Maybe there is a control that already does all this?
Thank You.
We use a similar pattern. MDI parent with menus for objects and tasks. MDI Child forms (about 30) for each object/task. Left "nav" button in three groups: 1:1 (calling up l related objects), 1:N (display lists of related objects - inspections, equipment, etc.), N:N:X (other complex relationships or tasks). The body has a tab control to group data. At least one tab is a datagridview that is reused for the 1:N lists.
Left nav button sets are dependent on the object being managed. We add the buttons dynamically but in most case they are hard coded - we just don't use the toolbox to place the buttons on the child forms. Each button set is in a Panel - I would probably use a FlowPanel if I were to start over.
We build a "model" form on one of the more complex objects, built all the data binding logic, and then used that form as a basis for the other objects. We didn't use inheritance as supplied by Visual Studio/VB.Net.
We do our own control data "binding." We use ADO.Net and SQL Server. Our child forms only display one record and do not support the typical record navigation seen in the wizard generated forms - this works fine in our case as we navigate sideways through our data. e.g. Application, Authority to Construct, Permit - then inspections, renewals etc. all related to one Facility. (we're a regulator agency)
We use VB.Net as a lot of the business logic was developed in VB6. I'd still use VB.Net today vs C# - much easier to use for business logic and more maintainable IMO.
One issue to consider - some have out the long knives for WinForms (and VB.Net.) I can't see Microsoft depreciating WinForms but there are those advocating that. Many cannot appreciate the simplicity (albeit limited flexibility) of the WinForms that allows us to concentrate on the business being done. I keep looking at WPF but simply cannot see the usefulness of all the UI power it provides. WPF proponents will push MVVM but that is just more complexity that is not needed for small scale development or production (20 users with desktops o a LAN) environments. WPF does not lead itself to our sideways navigation.
I think the left toolbar for selecting the form is a good pattern, but make it collapsible (hide) so the user could use all the desktop space.
As for MDI personally I don't like it because fell a bit outdated and cluttered. But again look for a balance of form and function.
For the top toolbar I would make it part of each form so it would be easy to program the logic. It an unnecesary complication put them on the master form.
As a recomendation you could look, Designing Web Interfaces even it's more focussed to web could give some pointers in user interaction.
For more informacion search ui patterns, user interaction design.

Winforms - how to create something similar to a master page?

I'm trying to build an app in winforms with something similiar to masterpages in asp.net - a menu on top and when choosing an option from the menu the entire screen on the bottom will change while the menu remains (there are 10-15 screens in the future app, some are quite similar, some are not).
What is the best way of doing this? Should I use different forms for each screen or use a panel or something else?
If I use a panel or something how do I manage to use the designer with so many panels taking space on the screen?
Try with the MDIParent Form's. View the Example
http://www.codeproject.com/Articles/12514/Multi-Document-Interface-MDI-tab-page-browsing-wit
If it is just keeping the same menu and opening/closing parts of the UI you could simply add and remove instances of usercontrols to the main form.
If you need more features such as docking (like Visual Studio) look at this
Another option is to use Form inheritance
Which one to select depends on what you want to reuse and the features you need.
One option would be to make your application an MDI window and then load entire forms, maximized, into the parent window.
Then, you would be able to treat each form as its own self-contained item, since it really would be exactly that.
Is it not an option for you to use WPF? A WPF browser application fits the paradigm you are describing quite well.

Frames vs User controls in WPF

I'm writing a Windows application in WPF. I based my UI in a single menu and a tab control to display different documents or application forms. Since the menu as well as other things are fixed throughout the application, I need a way to display the contents of each TabItem. I have found two:
write a user control for each form, or
using a frame to display the content of each form.
The question
Is there any other single way for doing this. How do they compare in terms of clean code? I mean, in .net forms I only need load the form from the menu.
I know, I should go for any pattern like MVVM, but for this very first time I want to use the default approach.
I go with Frames and host Pages (not user controls). I like Pages over User Controls as the event model seems to have more hooks.

How to manage toolbars with mvvm and WPF

I'm looking for a smooth method of managing toolbars (and menus) with mvvm in WPF.
Consider an UI with tabbed workspaces and heterogenous content (like Visual Studio). There the toolbars should be hidden or visible depending on the active tab. How would you design the view viewmodel for the toolbars?
I'd use a collection of toolbar-viewmodels and bind the ToolbarTray to it, but afaik that's not possible.
Any recommendations are apreciated.
Links to samples, best practice papers, etc. are welcome.
I had this same issue in one of my applications recently. I was using a Ribbon as my main toolbar, and based on what module was selected the buttons on the ribbon had to be hidden or shown. I came up with two different solutions... hopefully one will work for you.
The first solution would be to create a region in the shell of your application (it can be a Grid/Canvas/whatever) and dynamically load the desired toolbar into this region based on what tab the user clicks on. In other words, if you have 5 different tabs that require their own toolbar, create 5 UserControls that contain a toolbar and load the correct one into the region when the user clicks on the tab. Next you'll want to respond to the event of when the user clicks on a button on the toolbar. In my solution I used the Mediator approach to allow ViewModels to communicate with each other. It works, but I don't know that I would do it again that way... CAL is probably the better approach.
The other solution would be to create one toolbar with all of the required buttons and bind their visibility to the ViewModel. Based on the user's selection, set the visibility of the controls to whatever your requirements may be. Hopefully one of these solutions works for you.
by the way... what part of Germany are you from? I know a man with the last name of Stoll, so I wasn't sure if it was a common name or not...

Resources