Monday, May 26, 2008

How do I provide custom collection view for collection in WPF?

Some time ago, while "surfing" the WindowsBase.dll with Reflector, I have found one interesting interface: ICollectionViewFactory.
I made some digging, and found out that there are folks that are interested what is this interface doing (along with some other interesting interfaces...)
MSDN says nothing about this interface, but it turned out that it could be quite useful in fact.
Here is how it is declared:

/// An interface that enables implementing collections to create a view to their data. Normally, user code does not call methods on this interface.
public interface ICollectionViewFactory
{
/// Creates a new view on the collection that implements this interface. Typically, user code does not call this method.
/// The newly created view.
ICollectionView CreateView();
}

It turned out that when you try to create a default collection view for the collection(or when you provide your collection as an items source for the ItemsControl), databinding engine checks whether your collection implements ICollectionViewFactory interface, and if it does - your CreateView() method is called, so in case you want to implement some specific logic, like optimized grouping, or specific filtering - you just implement your own collection view and return it in CreateView() method.

Tuesday, May 20, 2008

My level in XAML :)

Several hours ago The Moth (seems to be Daniel in real life) have posted an article on the levels of XAML understanding.

The proposed leveling is as following:
Level 100 – truly understand all of the above.
Level 200 – confidently read XAML (e.g. as spat out by VS2008 or Blend).
Level 300 – be able to type XAML yourself with an aim to create a structure of a bland GUI (setting basic properties and hooking events etc).
Level 400 – create styles, templates, animations and set gradient colours by hand.

I think, that everyone, who created at least one custom control for WPF (well, I mean something that could be sold), have already achieved the XAML competency level 400 :) At least most of my coworkers did and so did I. I even think that there should be one more level - 500, like God-Like...I do not think that I have achieved such level but it seems that I am somewhere between 400 and 500.

Level 500 means that you definitely know how to implement something in code that could be used correctly in XAML :) Also such level includes knowing how every tag and attribute in XAML works (like the problem with focus scopes, when you should know from the beginning that moving element to the new focus scope will change the behavior of standard WPF controls).

But any way - now we have some kind of competency levels for XAML writers :) Great!

Sunday, May 18, 2008

Post2Blog - Windows client for Blogger, or blogging outside the IE

Recently I have decided that I do not like to make posts in my blog using it’s web-interface, so I have decided to find some windows client for Blogger engine. I have done some search and found a post about the Post2Blog software, so now I am writing this post using that program, and also I am thinking on how can I make money on something like that :-) BTW - funny notice - at the time when a guy wrote his post about this staff, it costed about $40, and now it is free. If I were him, I would be a bit upset now :-)


Post2Blog is really cool application - it supports a variety of blogging engines (Blogger and WorldPress for example), it supports automatic images upload (I do not think that I will use that feature, but still - it is there for free :-)), and finally - it is FREE.


There is one thing that seems to be missing - Blog2Post is all about posting to the blog and not managing the blog, so the access to the recent posts is a bit confusive...but still - great staff, wonder could it be abandoned and became free...