Best Approach for a MDI Application in WPF? [closed] - c#

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am developing a WPF Application for a Shop.
So i have a MainWindow and all the rest will be Child.
Which is the best thing to Use as Child Window.
Window
UserControl
Window will be normal, it will be top on the MainWindow and if its UserControl it will be in a Canvas of a MainWindow.
So can anyone suggest me which is best to use out of this two.

I would recommend using UserControls for your child windows. This allows you to set up all of the "parent" controls on your main window and the children won't override them.
As a further suggestion, I would recommend looking into Caliburn Micro. That is a great framework for dealing with WPF windows and user controls.
To add a child UserControl to the parent window, I usually just add a ContentControl to my main form like so:
<ContentControl x:Name="ViewWindow" Margin="10" />
Just assign your child to that control and you will be fine.

I suggest to use a MDI framework like AvalonDock: http://avalondock.codeplex.com/
You will save a lot of time.

Please refer the website : http://wpfmdi.codeplex.com/

Like many things in life & coding: it depends :)
Window
When the new window has its own state & behavior
When there is little to no interaction/messaging between the main window & the pop-up window
User Control
When the state of the underlying main window is critical for the operation of the pop-up
When state changes need to be passed between the 2 windows
These are some of the design decisions which come to mind...

Consider to check MDIContainer. A similar project than MDI for WPF, but it gives you more freedom, since it does not force you to implement MDIChild window, interface or anything.

Child windows will be great for a desktop application when you are decided to use a parent - child window interaction, although I personally suggest you to use a frame in your main windows and use it to host multiple pages.
To learn more about navigation in WPF and silverlight you can visit this link
Using this approach will help you achieve the following advantages:
Lesser chance of memory leaks due to unattached event handlers.
Consistent design could be achieve without indicating style for child windows because you could set page backgrounds to transparent.
Users wont have a hard time locating which window has the focus when other programs were simultaneously used with the software you are building.
I also think that there are also allot of stuff you could consider in building this software but in the end of the day you are still the one who should decide on this matter.
This is only my suggestion and hope this helps :) .

Related

How to achieve beautiful user interface like website on windows form app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have done a lot work on windows forms, In the past user interfaces were not important, but this time it is important. I want to create a windows form app that has a great interface, like a beautiful website.
shown one example below
Can I achieve this by any means in visual studio 2010? I don't have any experience of WPF, is it achievable there?
Yes, you can do this and much more in WPF (consider nice animations when you mouse-over or click items, or when tab changes, etc). Do not even try winforms, there are paid libraries, which can provide you with components to create rich user interface, but winforms is not flexible in any way by itself. In wpf you can achieve EXACTLY look you want.
Specifically to screenshot:
On top is some ItemsControl with items (DataTemplate) what has restyled checkbox (or vector graphics) and background bound to current item.
Below is ContentControl, which takes data template for current item (UserControl).
Actual content is simple restyled standard controls, it's very easy to make them looks like this.
Windows Forms is a legacy technology and does not provide you good tools to create your good looking custom controls. You need to work with low level API's to draw your controls like GDI+. If you are eager to learn, it is not that hard. It is indeed fun to work with GDI+ drawing shapes and painting them etc, but it will cost you a lot of time and it probably won't look too good.
Other than that if you want to stick with Windows Forms but develop your UI quickly, you can use DevExpress or Telerik libraries but they cost a lot of money.
As Sinatr said, the most common way is to go with WPF. You will access powerful tools like Blend and a modern API to create and customize your set of controls. You can still utilize DevExpress and Telerik control in WPF.

Differentiate Window vs Page vs UserControl in WPF? [duplicate]

This question already has answers here:
Window vs Page vs UserControl for WPF navigation?
(5 answers)
Closed 8 years ago.
I wondered if someone could help me. I'm new to WPF and am currently writing a desktop application, but I cannot seem to get my head around what to use when redirecting someone to a new section of the application.
My options appear to be
Window
Page
UserControl
but I don't understand what the difference between them is, and when I should use each one.
Could someone explain the differences for me, and give an example of what situations/applications you may use each one for?
I'm not sure there is a right answer here, but let me try and guide you. The Window class was created to allow you to have a true window. So, if you need to open a dialog, put it in a Window. Generally you will have at least one Window to house the main form.
A Page was built to be used with the NavigationWindow class. This allows you to build Page classes that are marked up like everything else, but just navigate to them under the covers. This is good if you have a single-paged application where the users just go back and forth between pages (i.e. a wizard).
A UserControl is a way to house reusable markup. These can be housed inside of any ContentControl. These can be swapped out of a "content pane" for example on the main window, like Outlook.
Using that, I hope it helps guide you in the right direction on when to use which. They each have their own uses and are not necessarily exclusive.

Did I find a way to use WPF and WinForms? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Well, basically I was fooling around a little, experimenting etc. I came up with the idea of trying to mix WPF and WinForms, the reason for this idea is I had / found something that I wanted to utilize in the already existing WinForms project.
I first tried to import the .xaml files from the WPF project, and that failed miserably. It imported them as BlaBla.xaml.cs and it just didn't work out. Next I took a look at the "WPF User Control (XAML)" file in the "Add > New Item..." but that wasn't what I wanted. I wanted to work two windows, one in WPF one in WinForms, in same project in same ".exe".
So next I tried using another technique. I made a new "WPF User Control", however simply removed the existing code from the "user control" completely, and just copy-pasted the xaml code from from the WPF projects .xaml "MainWindow.xaml". After that I just renamed the user control to "MainWindow".
Then came the problem of showing the MainWindow.xaml from my existing Main.cs (WinForm window) per button click. I first tried Application.Run(new MainWindow()); however that failed miserably, so I tried the traditional
MainWindow MainWpf = new MainWindow();
MainWpf.Show();
I also tried stuff like...
MainWpf.btn_num_1.Content = "3"; (A button inside the xaml window)
I also attempted to control my WinForm window trough buttons inside the XAML window, everything working just fine.
Now, my question is. Is this supposed to work this easily and simplicity?
You can embed WPF controls in a WinForms application or WinForms controls in a WPF application, using a simple adapter. Because of this inherent symmetry, you can build hybrid applications, mixing controls from the other platform. Michael Sorens gives a practical guide to WPF / WinForms interoperability
https://www.simple-talk.com/dotnet/.net-framework/mixing-wpf-and-winforms/

How to develop unique GUI's in Visual Studio? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
All programs that I develop utilize the default Windows Design template:
Besides from changing the colors of the form, basically every program I write has this layout. I'm wondering how people create more custom GUI's. I tried looking it up on google but I clearly don't know how to phrase it to search. When I say custom GUI's I mean things like:
I assume it comes down to customizing what loads, but I don't know where to look, or what to research.
you should check out WPF. it frees you from the standard windows form
Your app 10 years from now:
Easily implemented in Winforms btw. FormBorderStyle is None, the Region and BackgroundImage properties and some judicious OnPaint() code.
try one of the following:
DotNetBar
Elegant UI
DevExpress
Take a look at Metro Framework. It is free, open source and famous one. I have recently used it and found it is very attractive. You can also find screenshots of the gui and code examples on the above mention link.
If it really must be a native desktop app then use WPF.. otherwise, with the rise of HTML5 and the mobile device, i can't see any reason not to build cross-platform web apps.
For WinForms, most of the custom controls can be created by overriding the OnPaint method of a control and performing your own custom painting.
You could also use WPF, and create your own themes and styles
Or you could download a 3rd-party control such as the ones mentioned by johntotetwoo.
I highly recommend you to use WPF instead, if it is possible for you to use Expression Blend, i highly suggest using Expression Blend for Designing UI(s), Storyboards(animations) and customizing UI(s) then you feel like you are walking in heaven :)
Then i suggest you to use templates or themes for WPF. Like zune theme, and if you are interested in Microsoft Office themes, the good news for you is there is an overflowing of themes like this, just google it!
but is suggest you to design your own controls if you are able to use Blend except for those situations that you see you can not do this really.

How to Create Header,Content, Side Bar and Footer section (layout) in .net MDI application

I have one big existing application using .Net - MDI C#,
Now I am going to change some looks for application, so it looks better for client.
But I a, facing a lot of issues when I try to add more than 2 images on the Parent MDI Form.
How to create Header, Content, Side Bar and Footer Section in MDI (For. Ref. find attach screenshot for application layout.)? Also can anyone tell me which tips like which control I used for this type layout?
You have been a member for 6 months, asked questions, but never answered a question,never commented on a question, and never even accepted an answer.
But if everyone in this community acted the same way, if everyone else was just a user, where would you be then? There would be no community, no resource, you would never get an answer or have any information to search. Think about it. Then think about actually joining the community and stop using it.
Now to answer your question, the Winforms MDI container does not natively support the functionality you are describing, however it does support siting UserControls directly on the MDI container. This makes emulating the functionality you describe very easy. Just create a UserControl that provides the graphical surface and controls you need and then use the docking properties to force the MDI container to place child forms correctly in the open client area instead of on top of a UserControl.
For example, to create a logo and then a menu bar underneath create a UserControl with the logo and menu bar. Create events and wire them up as needed to allow the MDI form to subscribe to events that pass any menu clicks back that the MDI form needs to handle. Finally site the UserControl directly on the MDI form and set it's docking property to top. Then any child forms will display correctly in the remaining client area underneath the menu bar on the UserControl.

Categories

Resources