We all know managed code can have memory leaks. You can find a good example here: A .NET memory leak you did not think about. Microsoft provides us with the CLR Profiler, an open source tool for analyzing the behavior of your managed application, which you can download here. It contains very good documentation about the different functions of the tool, however I still find it a bit hard to start with, so here is a simple step-by-step example of how to use it. After you finish downloadoing it , extract the files and open the directory. there you will find the manual, you can read it later… Navigate to CLRProfiler\Binaries\x86 (or x64) and run CLRProfiler.exe.
Continue Reading...
SVG (Scalable Vector Graphics) is an open W3C standard for graphics file format and Web development language based on XML. Those image are made up of lines, curves and other “smooth” elements so when you zoom in on a SVG it stays smooth (unlike GIF, JPEG, PNG).
Imagine you can draw some of your user interface elements in a vector drawing application like: Adobe, InkScape (free) or Skencil (free) and convert your work into WPF XAML or Silverlight XAML. ViewerSVG (SVG to xaml converter) is your tool.

Continue Reading...
During the past couple of weeks we noticed that whenever we tweak our theme or change something in one of our posts, it causes some pages to become XHTML invalid. We came to think that you never know where it is going to hit you, so we sat down and created a small application which helps you keep all your pages XHTML valid. We checked it on our sitemap, and seems we have some HTML work to do :).
This application is written in WPF and is based on the .Net Framework 3.5.
It will allow you to validate you entire sitemap in one click. The validation is done through the W3C validation SOAP service, so you can trust it :).
Continue Reading...
Last week I was faced with a problem. I needed to implement a MouseDoubleClick Event on a WPF Grid. I said Ha, easy but as i went on to implement it i realized that the Grid has no MouseDoubleClick Event! So how am I supposed to implement it? I came up with 2 solutions and so here goes:
-
the first thought i had was to create a User Control that held only a grid and implement the MouseDoubleClick on the User Control itself so what you will get is this Xaml code:
<UserControl x:Class=”CustomDoubleClick.GridWrapper”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
Height=”300″ Width=”300″>
<Grid>
</Grid>
</UserControl>
Since the Grid takes the…
Continue Reading...
List<T>.Find() returns the first element found that matches a given criteria. So lets say we have List<int> and we use the Find method on it. What will be the returned value? If a number in the list matches the criteria it will be returned, but what if not? what does the variable zero contains after executing this code:
List<int> listOfInts = new List<int>(new int[] { 1,2,3,4,5,6,7,8,9});
int zero = listOfInts.Find(
delegate(int i)
{
return i == 0;
});
It has the value of…
Continue Reading...
Usually, we use Array.BinarySearch to find a value in a sorted array, we all know that this method returns the index of the searched value in the array, if value is found. It turns out that the return value of BinarySearch is much more interesting and useful. Lets focus on what happens if the value is not found in the array.
Those who claim that if value is not found than a negative number will be returned, are absolutely right. But most of us don’t really know the whole truth about that negative number and how it can be used.

Continue Reading...
DataTemplates are a great feature introduced in WPF, it allows to determine how data is presented and how data binding accesses the presented data. Just as we can apply a visual style to a specific UI control, we can do it for a specific data type. There is just one problem here, DataTemplates are good [...]
Continue Reading...
Comparison of a double with double.Nan (Not a Number) will always return false. Even (double.Nan == double.Nan) return false and indeed, from IEEE 754 specs: equality comparison between two Nan is always false. If we want to check whether a specific double is Nan, double.IsNan() shall be used. Lets look at how the IsNan [...]
Continue Reading...
If you are writing an application that uses font you will find this post very useful. Making a font selecting ComboBox that shows a preview of the fonts in WPF is very easy, here is how to do it:
First we will have to create the ComboBox Code, this is a regular ComboBox we have all [...]
Continue Reading...