Wednesday, August 25, 2010

Dynamic Treeview using XML

I've been dealing quite a lot with WPF, but here is an interesting solution for ASP.Net.

I wanted a dynamic TreeView control to act as my navigation for a Web Application. The whole idea was to expose the links/items to a user only if she had permissions to view the page. Permissions are set via an other custom Web Application. Basically, each page has a PermissionId and each User is bound to a Role that has (or not) permission to a page.

Tuesday, August 24, 2010

Animation in WPF

One of the coolest things about WPF is the animation power it has. WPF has moved past the old Win32 and GDI/GDI+ libraries and instead uses DirectX. This allows for more powerful animation and graphics.

The thing to remember though is in order to have a nice looking animation, it should not lock the UI while running. If it does, you probably won't have a chance to see the animation happen!

So, here is a small sample of how to do this:

Monday, August 23, 2010

Creating Custom Formatters for WPF ListView

In the previous post I showed how you can create and bind a ListView using LINQ. Now, if you want to format a value in one of the columns, one way to go around this is using StringFormat. Here is a very good blog entry explaining this.

StringFormat however allows for mostly basic formatting. What if you want to do something more complicated?

As an example, and since I am from Cyprus, I wanted to format an Amount column to display as currency but with the Euro symbol.

Friday, August 20, 2010

WPF ListView and LINQ

After dealing with traditional WinForms DataGridViews, when you are trying to display information, I find that ListView in WPF is much more easy to code.