Using catel with 3rd party controls - wpf

I'm new to catel and mvvm. I 've successfully built a sample application the "catel" way and I like all the added features which I do need (thank you for the great tutorials). I've successfully run a sample app using typical mvvm and a 3rd party control printing reports. When I tried to use the 3rd party control in the catel application I had issues making it work, even with the information provided in catels' documentation. Even if I do manage it to work, I don't want to make custom base classes to add new controls, because most of my controls are special (3D). So, my question: can I use all of the catel features, including model and viewmodel capabilities, but use external windows and controls with the typical manual binding procedure? Do I need to know of any special concerns?

I learn catel since 2 weeks too, welcome into the Catel World :)
So, you can create custom window base class with IDataWindow and your window inherit Catel features. Need more coding but not a lot !
I suggest you to consult the excellent documentation here for Custom Window and here for Custom Control
Hope it's help !
Dams

Related

WPF Multiple Instances of Windows and MVVM

How do I use multiple windows in an WPF MVVM app?
I have a Main Window with a menu control that needs to open up new instances of the window each time the item it is selected. I need to be able to show windows next to each other, it is a requirement and not page or usercontrol navigation.
Does anyone have an example of doing this?
I've read it is not recommended UI design but it is the requirement I have to implement.
Actually I have this working by using the WindowManager from Caliburn.Micro which seems like an very excellent framework for this type of application. I did look into prism but it seems over complicated and Caliburn is very easy to understand which did meet the requirements. I looked into MVVM Light but the documentation is horrible and lacks examples and I don't have time to figure it out.

Silverlight MVVM framework

Just out of curiosity, wanted to know if there is a need to use any MVVM frame work available as third party installable or we can directly create and define different projects in our application and call them as Model, ViewModel and View, and also use them as per their definition.
Does the third party framework provide anything extra and can a application as mentioned in the above paragraph can be called as MVVM compliant.
No you don't have to use any third party framework, you can just follow the design pattern. You can follow this link to find out more.
http://www.silverlight.net/learn/advanced-techniques/the-mvvm-pattern/using-the-mvvm-pattern-in-silverlight-applications
If you're looking for an MVVM framework then I would suggest Catel
The approach which you're thinking of is not what I personally would call 'MVVM compliant' (altough it is only a pattern). Normally your Models are classes to describe and access your data (Linq2Sql entities), ViewModel are classes which drive the applications business logic and your Views are just windows/pages etc.
Normally I just create folders in my main project for all three of them and take it from there but sometimes it is a good idea to get the Models into a separate project if they are going to be used by other ones but I would normally call it something like MyProjectData
No, it's not necessary to use any of the available MVVM frameworks, you can create your own MVVM framework and use it. If you folllow the guidelines for MVVM patern and implement the framework correctly then the application would be MVVM compliant.
But yes MVVM frameworks have there advantages, they provide a lot of features/base classes out of the box which you will have to implement yourself in your custom MVVM implementation; for e.g. Prism provides a standard way of solving various problems/scenarios encountered in SL or WPF application (EventAggregator, Navigation framework, commanding etc.).
Have a look at this question which I had asked about Prism -
Custom MVVM implementation Vs. PRISM
No, you don't need to use third party framework for it. You just need to follow the architecture of MVVM and try to implement your code in that. Your can learn more about MVVM here enter link description here
Best for MVVM Architecture

Silveright User Control validation

I follow MVVM pattern in one of my silverlight pages.
I am trying to add validations for one of my usercontrols which should look like those which work with the Silverlight native controls. Is it possible for me to do that? Do I need to add special code to handle this?
if you could post your code then i might be able to help. But as per your question i think there are available user-validation controls for Silverlight that you can just drag and drop and then use.
They are available in most of the new IDE's.
Make sure your ViewModel implements IDataErrorInfo and then you can hook them up to the controls.
You can look at a good article here:
http://www.arrangeactassert.com/using-idataerrorinfo-for-validation-in-mvvm-with-silverlight-and-wpf/

Migrate application from WPF to Silverlight

I saw a lot of question on this topic and it took me some time to decide whether or not I would write another one ... but I think my question is a bit more complicated ... so here we go.
I'm currently working with a WPF application using MVVM.
The application is built with:
WPF
Prism V2
Ideablade (devforce) to access a database
Avalon dock for the docking feature
Telerik for the grid component
Views and ViewModel are generated with .tt file.
Views are generated in xaml (for WPF) files.
I know that:
Telerik has Silverlight controls
Using Prism V2 will probably help me doing a Silverlight version of the application
I don't know:
If the usage of devforce can be a show stopper
If the usage of avalon dock can be a show stopper
My question:
Appart from generating xaml for Silverlight ... where do I start ...
----EDIT----
Please, avoid any comments like "Silverlight will die" or "Silverlight xaml is a subset of WPF xaml".
It is a proof of concept and should be made using Silverlight. For the xaml, I can modify the application to use only simple ui element that can be both in Silverlight and WPF.
Depending on how you actually used Prism and other frameworks this can be a lot of work or quite easy.
I'd start at the 'bottom' because I'd expect the Models and ViewModels to be quite portable, at least that is what I have experienced so far. She fact that Silverlight more or less forces you to write async code everywhere might encourage you to investigate in (yet another) framework such as Rx
The Views could be quite a hassle; you will have to find controls that provide the same features that you are using in WPF, build them or invent something new. That can be a lot of work.
Another thing to consider is when your WPF app relies on many desktop features you might consider creating an Out of Browser Silverlight App.
As with any project try to find areas that will probably need a lot of attention and do those first; it's a waste of time to get a lot of stuff working to find out later that you will have to replace it because of an impossibility elsewhere.

Silverlight and MV(VM) Pattern - No Code-Behind - Is this possible?

I am working on Silverlight 3.0 and currently using code-behind in my Views. I would like to implement the MV(VM) pattern into my project as the project is growing. I have seen some WPF projects where the code-behind has NO CODE except for the InitializeComponent method, which I believe is the right way to go and just looks clean. Is this possible in Silverlight 3.0, that is, no code-behind?
Can anyone point me to some good Silverlight (3.0) MV(VM) tutorials / articles?
Without using some additional framework, Silverlight 3 does not support what you saw in WPF. Specifically, full Commanding support. Silverlight 4 has included Commanding for Buttons, which is a start.
You can look into other frameworks that provides this feature set, like Prism. This will get you along the right path, but I'm sure there are other options.
You can follow the MVVM pattern for Silverlight 3 applications without using a framework. However, it is much easier to use one of the many MVVM frameworks out there. Here are a few good ones:
MVVM Light
MEF
Simple MVVM
I'd recommend not using Prism as it is more complicated than it needs to be.
Other options include things like MVVM Light, which is lighter weight alternative to Prism for things like handling events and commands, however Prism does have a lot of functionality (and the Prism 4 talk has that sounding like a good option when it gets released).
One good community site to check out is the Composite Development Patterns Community, which was newly started but has an excellent goal of collecting articles and other help for working with development patterns like MVVM.
Lastly, John Papa gives a great overview of MVVM, limited to links so head to Google and look up "John Papa MVVM". :)
One thing to consider though, resources for SL3 aren't going to be as valuable as those for SL4, which opens up additional options for framework based commanding (ICommand that greglev mentioned), although it isn't still the full command support from WPF.
Jesse Liberty has a good primer on MVVM also using Behaviors for wiring events.
Silverlight and MV(VM) Pattern - No Code-Behind - Is this possible?

Resources