WPF & MVVM: Visual Studio like interface - wpf

I would like to create an application using WPF and MVVM Light but i don't know how to organize my application layout for a MVVM application. The idea is to have something similar to Visual Studio:
A main Window with tabs, toolbox and menu that can be docked and moved to different locations. I had been able to easily create this layout using Telerik WPF controls and their sample but all in a simple XAML file with it's code behind, I have no idea how to transform it into a MVVM application.
I would like each pane/window/toolbox to be a different view with its own View Model. I checked tutorials but I didn't find how to have one single application displaying simultaneously multiple views/viewmodels in the same "main window".
Have I do define each view in a specific user control? Have I to use ContentControl to organize my layout? Should I use data template? How to handle binding on multiple view/viewmodels within the same window ?
Thanks a lot for your help!
Doots

look at using http://avalondock.codeplex.com to get a layout like visual studio. Then you could put usercontrols in the LayoutPanes for your views, and have those binded to your viewmodels.

Thanks for your replies! Now i understand, I think I was searching way too far and made it more complex than it should...
Avalon seems a very nice solution, but I have a Telerik licence then I will go for it. If anybody is having the same issue, just take a look at this answer from Laurent Bugnon: http://mvvmlight.codeplex.com/discussions/252035
Thx

Related

WPF Usercontrol Inheritance

I am new to WPF and I am facing a problem here. In one of our application, few dialogs responsible for similar kind of work. All dialogs have OK and APPLY buttons. But in our new UI Design, these will be displayed on a side bar which is a panel(Yet to decide control). I thought of having a Base Usercontrol which will have OK and APPLY button with few methods. And my other dialogs(which are Usercontrols now in new UI) are derived from this Base User Control.
I downloaded few code samples from internet, but problem didn't solve.
If you have any idea/code sample please share.
Thanks in advance.
WPF (also WinForm to some extent) doesn't play well with inheritance. You could create the UI in C# code and get inheritance working but I don't think designer play well so you'll be stuck in design mode and in Blend.
To work around it you could create piece of functionality that you want to reuse and use composition instead of inheritance, which is considered a better approach anyway.

Silverlight custom controls

are there good books on developing custom controls for silverlight?
What I want is to create a grid-control that can also act as TreeList-control. Can you tell me what is a good base-class for such a control?
And another question: If I develop a control in Silverlight, how can I reuse my code for the same controls as WPF?
Do have to duplicate the code? I hope not...
Bye
Matthias
What I want is to create a grid-control that can also act as TreeList-control. Can you tell me what is a good base-class for such a control?
Basically, it depends on several factor and you have more options. In my opinion, I would choose to go with Panel, incase if I need more control during layout and arrange process.
Or else, you could simply extend from the ItemsControl and write you own control. But if you are planning for much bigger implementation, then I would highly suggest you to read the implementation of GridControl available in the WPF Toolkit.
Tree List Control On Code Project
And another question: If I develop a control in Silverlight, how can I reuse my code for the same controls as WPF?
Sharing Code Between WPF and Silverlight From MSDN

Custom Wpf ListBox Control

I'm new to wpf and have just been given a project to create a set of custom controls which will be used to make a previous windows forms application more manageable and current. However I cannot seem to find much info with regards to customising the built in Listbox, this would involve preferably replacing the scroll bar and the +/- buttons with custom images etc..
Just wondered if anyone knows how to get at these ?
Thanks in advance.
Check here for the default control template of the listbox.You can customize the scrollviewer there to do what you are looking for.Check the below article to get started
Using Templates to Customize WPF Controls
Learn about WPF styling and templating. Other than that, the question is too generic for SO. Read the article (and perhaps google some more articles on the topic), try to style the listbox and come back with specific issues. WPF is not easy to get into, but it is definitely worth the time.

Wpf template gallery

Does anybody know of a gallery of controltemplates, that I could use to learn more about what is possible with the different control types?
look at : https://github.com/jogibear9988/wpftoolkit
I've forked the Theming Package from Codeplex and switched to .Net 4.0
I'm not familiar with a gallery of control templates, though there are lots of examples on the internet. If you have a specific control you'd like to template (e.g. a ListBox or a Button), I would search for specific control templates that relate to that control. You will find countless options.
If you want to learn about what is possible with control templates, I'd suggest picking up one of the many great WPF books. A few I'd recommend are:
WPF Unleashed (by Adam Nathan)
Applications = Code + Markup by (Charles Petzold)
WPF Control Development Unleashed (by Pavan Podila and Kevin Hoffman)
You can completely recreate the visual tree of an element with a control template, so the possibilities are limitless. You can also check out the MSDN Help Topics on control styles and templates:
Control Styles and Templates
Using Templates to Customize WPF Controls
Hope that helps.
There's this one
http://www.xamltemplates.net/
There's this one
http://www.reuxables.com/
There's this one
http://www.codeplex.com/Silverlight/Wiki/View.aspx?title=Silverlight%20Toolkit%20Overview%20Part%203&referringTitle=Home
As a word of warning, all templates are not created equal - and not all templates will work across all XAML frameworks. For example if it is written for SL it may not work for WinRT. The same for WPF. But this list will get you started. In the end, you will probably create your own.

Have a wpf window inside another wpf window

Is there a way to host a WPF window inside another WPF window. I have a couple of somewhat complex forms in place. But now to simplify things I am trying to merge a few of them as tabpages inside one 'Dashboard' form.
Please note that I am not trying to host a Windows Form, but another WPF window
If you want tabpages, why not use a TabControl with UserControls inside ? If you need to transform one of these tabs to a floating window, just put the UserControl in a new Window...
Can I answer this question with another question; why would you not create them as controls rather than other WPF windows, that you want to host in the main WPF window?
a bit late on this, but I guess with WindowsForms interop you can put in WPF a WinForms control host and in that host put a WinForms control that hosts the handle of a WPF window
I think what you're asking for is MDI, Multiple Document Interface. Something like this might help.
Do note, however, that the MDI paradigm is largely shunned these days. There are usually better ways to achieve the same functionality.
I think you want to hosting contents of WPF Window1.xaml (page1.xaml) inside within another WPF Window.
Well...you can use Navigation. Instead running window1.xaml contents inside tab then you can work with your data inside Navigation. Navigation can run within WPF Window Application. You just design your form / UI in page1.xaml.
one another..MDI old and rusty. We want clear of top window nowadays.

Resources