Sunday, August 28, 2011

Monday Mornings : Extensibility in .NET 4.0

It is my great pleasure to speak at Microsoft Moday's last Monday on 22nd August 2011. I have introduced a way to develop a plugin based application with and without MEF. I have also touched some of the interfaces which Visual Studio uses for Extensibility. It has been a very good session and I have learned a lot from it.

If you are a part of the session, please get the Power Point Presentation and the updated source code.


Saturday, August 27, 2011

Steps to write a plugin based application with MEF

I have already written a blog on Managed Extensibility Framework few days ago, and you must wonder why I am writing again. Well actually today I have been creating an application that could be easily plugged into a host application. In this blog lets show you in steps how you could easily create your own plugin based application and later change itself easily using MEF.


Monday, August 15, 2011

.NET Tips : List of my short tips

Hi Friends,

As I have already told you that I have been publishing short tips in DailyDotnetTips regularly, it is time to share the links with you to keep you updated. Please read these short tips from me and give your feedback.


  1. Using ReaderWriterLock over Monitor for Thread Locking
  2. What is the use of IsBackground property of Thread?
  3. Co-Ordinated Thread Shutdown with and without using CancellationTokenSource
  4. Writing a Stretchable ContentControl in WPF
  5. What is Visual Tree and Logical Tree in WPF?
  6. Dealing with HWND in WPF
  7. Hosting a WPF control inside a Windows Form
  8. Accessing local assemblies in XAML
  9. Difference between a UserControl and a CustomControl
  10. Hosting a Windows Forms control inside a WPF
  11. Use x:Shared to write your FrameworkElements directly as Resource
  12. Use BitmapScalingMode to ensure your rendering of Image is perfect
  13. Object hierarchy of NULL
  14. Lazy Initializer to defer expensive Object creation in .NET 4.0
  15. Working with Co-Variance and Contra-Variance in .NET 4.0
  16. Using Complex Numbers in .NET 4.0
  17. Working with BigInteger in .NET 4.0
  18. Working with SortedSet in .NET 4.0
  19. Common Table Expressions in SQL Server
  20. Compiler directive #Pragma reference

So here are my last 20 short tips posted on DailyDotnetTips

I hope you will like these tips. For full list of all the tips and the latest updates, check this link

Happy Coding. 

Thanks. 

Sunday, July 31, 2011

Internals of Dependency Property in WPF

WPF introduces new property system to us. Every WPF objects that is inherited from DependencyObject inherently supports Dependency property containers within it. That means you can define your own dependency property in your code which can take part in some of the interesting features of WPF like Binding, Styles, Triggers, Animation, Property Inheritence etc. Today I will concentrate on how Dependency Property system is actually built and what are the benefits we get instead of using CLR property system.

Note : If you are really new in WPF and don't know about Dependency Property, it would be nice to read my post on Dependency Property or you can also try WPF Tutorial series to start on.



So lets start on using the most basic code of creating your own Dependency Property.

Sunday, July 24, 2011

Writing a Reusable Custom Control in WPF

In my previous post, I have already defined how you can inherit from an existing control and define your own reusable chunk. The reusable XAML code that I have defined there is actually a composition of one of more existing elements in a common design surface. But sometimes you must define  a new behaviour for your reusable component which does not belong to any of the already existing behaviors. Custom controls can help you in this. You can define a new behaviour for your Custom control which can have a default look and feel defined for it, and obviously which can be changed using Template for the user who is using the control. In this post I am going to provide you step by step approach on defining a Custom Control for your application.

Note: If you are really new to WPF, please read my WPF Tutorial before going further. 

Steps to Create a new Custom Control

Creating a custom control is very simple. Just in your project right click and add a new Item. In the dialog box that appears, choose Custom Control template and Name it. I call it here as SimpleControl.


Once you have added the control, it adds up a new class to your project which inherits from Control. The Template also provides you with some initial help to define your own control. Lets remove all the comments for now and start building a control.

Download Sample Code


Saturday, July 23, 2011

Writing a Reusable WPF Control with Design Support

Code reusablity is one of the major concern to many of us. When dealing with large projects, modularizing your project is one of the primary thing that you should look for. I have talked about many of the approaches that you can use to deal with modularizing your code, eg, Prism. In this post our intent is not to talk hard on some pattern, rather I will discuss how your WPF application supports code reusability. There are a number of approaches that WPF supports to deal with reusable component. We can use Resources to define a Resource or even use CodeBehind to write our reusable component or even load the XAML from a file using XAML Loader. Each of the approaches has its own pros and cons. Today I will show you another cool technique to write a reusable XAML for your project which will allow you to easily use Visual Studio design surface to design the component.

Note : It is a very basic article, if you want to know about details on WPF, please read my tutorial on it.

Steps to Create your Reusable Component


Lets create a series of steps to create a reusable component for your application to make it easier for you to write one yourself.


Sunday, July 17, 2011

ValueType and ReferenceType : Under the Hood Part 2

Well, if you have read my previous post, you should be already clear how memory of ValueTypes and ReferenceTypes are allocated and De-allocated internally in terms of IL. Here in this post, I am going to cover some more concepts behind ValueTypes and ReferenceTypes and what exactly comprises of them.

In my previous post on the series, I have told you that any type that inherits from System.ValueTypes is stored in Stack while any type that is not inherited from System.ValueType is stored in Heap. Well, the statement is not correct totally.

Author's new book

Abhishek authored one of the best selling book of .NET. It covers ASP.NET, WPF, Windows 8, Threading, Memory Management, Internals, Visual Studio, HTML5, JQuery and many more...
Grab it now !!!