Skip to main content

Posts

Showing posts from June, 2010

A Convention based Approach for wiring your Views to ViewModels in MVVM - AutoViewModelLocator

Preface This post assumes you are familiar a bit with the MVVM concepts. Otherwise, here is a 5 minute overview from John PapaHow do you wire up your ViewModels to your Views in your WPF and Silverlight apps? Of course, the simplest approach is assigning your View Model’s instance to the View’s data context, in the code behind :). /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.DataContext = new MainViewModel(); } Understanding The ViewModelLocator ConceptAn alternate way to do the above task is via a ViewModelLocator implementation, mainly so that you can preserve the Blendability - to enable designers to see see the correct preview of the View. Laurent Bugnion has a pretty neat implementation of ViewModelLocator in his MVVM Light toolkit . A simple approach to use ViewModelLoator in MVVM…

#DevCon 2010 by K-MUG : Agenda, VS2010 Launch, Location, Speakers, And Places To See

K-MUG (Kerala Microsoft Users Group) is pretty excited to announce DevCon2010, the Grant Developer conference in Kerala – The God’s own land. DevCon 2010 will be conducted in Park Centre, Techopark, Trivandrum, Kerala - on 3rd and 4th July, 2010. We have different sessions planned as a part of this event.A lot of excitement is there in the air, and the focus will be on Cloud computing, VS2010 Features, Robotics, Windows Phone 7, Azure, Application Compatibility, ASP.NET etc. I would be one of the speakers as well. Walk in, uplift yourself, and go back with some great energy.We’ll also launch Microsot Office 2010 during the event.SpeakersWe’ve got speakers including Janakiram, Vijay (msigeek), Ramaprasanna, Shobhan, Shiju, Sreeju, Praseed, Jene, Manu etc.  Checkout the speakers page in DevCon 2010 website. Oh yea, I’m also taking a session. I’ll be taking a session on VS 2010 + .NET 4.0 – I’ll talk about New VS2010 Features, and .NET 4.0 Frameworks. A session on Windows Phone 7 is also…

Book Review: JQuery & ASP.NET Controls – 51 Tips, Tricks and Recipes

My copy of JQuery & ASP.NET Controls – 51 Tips, Tricks and Recipes (published by DotnetCurry fame (and my friend and ASP.NET Architecture MVP) Suprotim Agarwal) arrived some time back. I paid some serious attention to the book over the last couple of weekends, when I was playing around with JQuery a bit to implement some desired user experience. I should say I’m pretty impressed with the book – mainly for it’s practical value, and about the way it is organized. The whole book has ten sections, with multiple recipes under each section, detailing specific tasks. In short, you’ll be able to quickly find how to implement a specific functionality in JQuery, just by looking at the index. I feel that the practical value of the book is immense. The examples and explanation are clear and concise – you don’t find any useless crap there. Each recipe has a problem statement (challenge), solution (the actual code),  Explanation of the code, A link to a live demo, a note on Browsers supported, …

Creating a custom View Engine for ASP.NET MVC leveraging Text Template (T4) engine for rendering the view

This post explains how to create a View Engine for ASP.NET MVC, leveraging the Text Template (T4) infrastructure already out there for rendering the view based using a custom T4 template host.Clarification: Here, I’m not using T4 for design time code generation. We are using T4 toolkit to render the views during runtime.[+] Download Related Source CodeFor me, the most beautiful aspect of ASP.NET MVC is it’s extensibility – they way you can ‘stretch’ the framework, to make it suitable for your own needs. I highly recommend you to read this article from Code Climber’s blog - 13 ASP.NET MVC Extensibility Points you have to knowIn this post, we’ll explore the following concepts.ViewEngines in ASP.NET MVC Creating a custom ViewEngine for ASP.NET MVC Supporting multiple View Types (our view engine will support both aspx/ascx files and tt files) Partial rendering between view types (you can render a tt view from an aspx view)Preface About View EnginesThis is a quick recap on how the View …

MEF or Managed Extensibility Framework and Lazy<T> – Being Lazy with MEF, Custom Export Attributes etc

Overview The objective of this post is to brief how you can leverage the lazy initialization support available in MEF. We’ll examine MEF and Lazy, and then we’ll see how to use them together.Preface About MEFI hope you are already using Managed Extensibility Framework to build beautiful software. If you are not yet there, that is a crime, and I highly recommend you to read my introductory post on MEF. Let us start with another very basic MEF example. Let us get back our Zoo. We are composing our Zoo with a couple of Animals here. //Abstract animal interface interface IAnimal { void Eat(); } //Concrete animal 1 [Export(typeof(IAnimal))] class Lion : IAnimal { public Lion() { Console.WriteLine("Grr.. Lion got created"); } public void Eat() { Console.WriteLine("Grr.. Lion eating meat"); } } //Concrete animal 2 [Export(typeof(IAnimal))] class Rabbit : IAnimal { public Rabbit() { Console.WriteLine(&qu…