• Transpose or just rows as columns

    A common scenario when displaying tabular data is to flip the axis so your rows becomes columns and vice versa. This can be easily achieved when you know the shape of your data. For example imagine we have a Customer class with 3 properties:  Name, Age and JobCode. Let’s say that we have 5 customers in our data repository. If we want to select just the names we can do something like this:

    IList<Customer> customers = Customer.GetAll();

    var names =

        new

            {

                Customer1 = customers[0].Name,

                Customer2 = customers[1].Name,

                Customer3 ...

  • IntelliSense for Expression Blend

    [Update]: You can find the addin for Expression Blend 2.0 SP1 here.

    The problem

    Expression Blend has been out in the wild for quite some time. However one of the most annoying thing was the lack of autocompletion (aka IntelliSense). Most of devs/designers out there were constantly switching from Blend to VS and backwards to do their stuff. The great free tool Kaxaml is at great help as well.

    The solution

    Using the Blend 2.5 add-ins architecture I have created an add-in that adds IntelliSense in Blend. I have reused the code from Kaxaml and adapted it work ...

  • [ReSharper] Directory name donates namespace Yes or No ?

    imageIf you like us are passionate user of ReSharper you know that ReSharper "did not like" when a class' namespace did not correspond to the directory structure the file belongs to. To illustrate this lets look at a simple example.

    Imagine that we have a project named MyProject. By default its namespace is MyProject. Lets have a folder named MyControls in the project as well. Now lets add a class file in that folder, naming it "MyControl.cs". The default namespace that will be generated for the class will be MyProject.MyControls. It is constructed using the ...

  • Tip of the Day: Clear your ClickOnce application store

    ClickOnce is a great technology that blurs the line between web and client(windows) applications. You can use it to easily deploy windows forms and WPF (through XBAP) app's. However there is common problem with it. The application store (the place where all ClickOnce applications get stored) has the ability to corrupt it self ending in an appropriate version mix of your application. You can end up in situation where "it works on my machine", but in reality the application did not work correctly. To avoid such situation it is a good practice to clear your application store before testing the ...

  • WPF Series: IFrameworkElement - the missing interface

    If you are familiar with WPF you are aware that the the grand daddy of all controls is FrameworkElement. It is defined in the PresentationFramework.dll assembly and derives from UIElement (defined in PresentationCore.dll). Its purpose is to serve as a base element for all framework related stuff: styles, inheritance context, etc. However there is another framework element - FrameworkContentElement. The main distinct between them is that the later did not defines its own rendering behavior (its inheritors should do so). This is way properties like: (Actual)Width or (Actual)Height are not present at FrameworkContentElement. If you examine the classes ...

  • WPF Series: Creating Generic Adorner

    As I have mentioned at the end of the previous post today I will show you how to create a generic adorner, which will allow you to decorate a single element  multiple times at different positions. At the end we will be able to create something that looks like this:

    TopicWithAdorners

    To achieve this we will need a way to say that we want to position the adorner at the different corners of the element as well as to specify whether we want to be inside or outside (vertically or horizontally) of the element. Let's create some enumeration types that will ...

  • WPF Series: Adorners, Commands and Logical Tree

    Today I'm going to tell you a WPF story. But before I start to dig deeper let me first introduce you the main characters in this post. Here they are:

    • Adorner - adorners are simple UIElement decorators. Suppose that you have a RichTextBox and you want to place a comment box over it, so that users can comment on the text in the box. This can be archived with adorners. Actually the WPF framework uses adorners internally for exactly the same purpose when you edit and annotate FlowDocument in a DocumentViewer. This is the reason why adorners are in ...