I am stuck in how to use DataTamplete in WPF, someone knows some tutorial or has a colection of turorials that teach how to use it??
I'm using MVVM Pattern, so if you know a tutorial in mvvm examples it will be better. ;)
Tks!
Googling "wpf datatempalte tutorial" give following links. i would recommend #2
Data Templating Overview - MSDN - Microsoft
WPF Tutorial | Data Templates
A Guided Tour of WPF – Part 4 (Data templates and triggers...
MSDN explains it well MSDN Data Templating Overview
Things to watch out for are that your itemsource is set correctly and that the properties you are binding to are public.
Related
I am new to WPF and MVVM and am working on an application which has a few views. Right now I have a View(HomePageView) shown in the shellView's context. Now using a button in the HomePageView I want to load another View in place of the currently shown HomePageView. After looking it up on google, I found something about Event Aggregators. I would request someone to explain the implementation or direct to a good sample application.
If your new to WPF MVVM I'd suggest first picking a decent helper tool
There are quite a few options. MVVM Light, Prism, MEF
I'd suggest MVVM light. Simple and easy to get up and running. Prism isnt solely a MVVM Helper but includes features to assist with MVVM. Not done much with MEF myself or things like Caliburn Micro.
As for a sample to explain how navigation between views work with MVVM Light try:
http://www.codeproject.com/Articles/323187/MVVMLight-Using-Two-Views
MVVM Light on CodePlex:
http://mvvmlight.codeplex.com/
^^ link has forwards to some video presentations totally worth watching
Another nice sample using MVVM Light:
http://apuntanotas.codeplex.com/
These should help you get started and you always got https://stackoverflow.com/questions/tagged/wpf for particular questions :)
Can anybody tell me some tutorials or study materials for learning WPF styles for button,labels and for other wpf controls.
I Searched on google but no proper material i found for a beginner like me.
Start in the MSDN: Control Styles and Templates
You can use Blend to copy the existing style/template and examine those. If Blend is not available you could serialize the Templates and styles yourself using the Xaml Serializer.
http://wpftutorial.net/ is a great website..
look at http://wpftutorial.net/Styles.html
Maybe this is not the exact answer to your question but if you really want to get deeper in WPF technology I sincerely recommend the best book about WPF (which also covers the idea of styles):
WPF Unleashed
For a couple of weeks I'm reading (and experimenting) with silverlight and mvvm pattern. I've learned a lot about it and I think I understand the basics of the pattern and framework but still I have few questions about practical usage of mvvm pattern. I hope someone with bigger experience then me can help me :)
Here are my questions:
Let's say I have many TextBlocks in my View, should I put readonly properties in the ViewModel for every TextBlocks? Should I do that with every text that I have in View? I feel it as a bit overwhelming and I wouldn't do that.
What about localization? Using resources files is the the best we have? Or should it be translated throughout properties in ViewModel?
Is there any good logging framework for SL? or I shouldn't use any and only focus on logging web services?
I've found this link: MVVM-light + RIA Services best practices - but I can't find answers to all my questions.
Edited:
Thanks to Adam I've found nlog: http://nlog.codeplex.com/ but it's in beta. Does anyone know anything else?
#1 - NO, you would not normally put readonly properties in your VM just for your view to bind its textblocks to. Those text values are just part of the view, just like they would be for an MVP WinForms app, or an MVC Web App.
#3 - possible duplicate of Silverlight Logging framework and/or best practices
For #2 If you use silverlight business application, you already have full support for localization. Check this out Silverlight 4 + RIA Services - Ready for Business: Localizing Business Application and I would do it on XAML level instead of VM
I highly recommend the MVVM In The Box training from my colleague Karl Shifflett of Microsoft patterns & practices.
I'm looking for a WPF prism with ribbon application samples and tutorials. I have found many that cover prism or ribbon but only a few sources provide any information about implementating those two together in one application. No course code usually in available tough. An example with a few simple modules and a classical ribbon tab control would be perfect for me to start.
Thanks for any help.
Regards,
Enzo.
Edit:
I should add that by combining the two I want to be able to load different modules depending on the ribbon tab selected by user.
You can find some info on a customized region adapter for the WPF Ribbon Preview here.
Regarding the loading of modules on demand in Prism, here is another link to MSDN, covering the topic.
David Veeneman wrote a nice article about Ribbon & Prism on CodeProject
http://www.codeproject.com/KB/WPF/ViewSwitchingAppsPrism4.aspx
It includes RegionAdapter for Ribbon .
There is "Southridge Hands-On Labs" on Codeplex (download on WPF futures page). It is quite extensive, but documentation and source code are not in sync (it looks they updated labs source, but not accompanying documentation), so it can be a pain sometimes to get what is going on.
It is based on Microsoft's WPF Ribbon Preview library.
Edit:
I am not aware about any tutorial that covers both. You can check series of videos on Prism and Silverlight by Mike Taulty. There is also source code for application made in last video.
Then you can combine knowledge from Southridge labs and this Prism tutorial.
I ran into a similar problem this weekend and after much reading and searching came up with this code that I posted for review
https://codereview.stackexchange.com/questions/429/mvvm-wpf-ribbon-v4-with-prism
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?