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.

Friday, April 23, 2010

Troubles in ToggleButton land - 2nd take

As I continued my investigation of the ToggleButton issue mentioned in my previous post, I discovered that if you set the Focusable property of each ToggleButton, the border left on the pressed button when pressing any of the other buttons disappears. 

The issue though with this approach is that the ToggleButton may no longer be selected using the keyboard Tab button. If this is acceptable in your project, then this is a great way to solve the issue.

Again, this issue is reproduced on Windows 7 machines. I'll investigate if this holds for Windows Vista/XP machines. If not, I might submit a bug report.

Thursday, April 22, 2010

Troubles in ToggleButton land

I was recently developing an application in WPF that uses a TabControl control as a ribbon-style navigation bar. I wanted the user to press a ToggleButton and a Frame control at the bottom of the Window would load the requested Page.

Since the TabControl would serve as a navigation bar, I wanted the user to visually be able to see which page was loaded by having the ToggleButton in a Pressed state.
So far so well. When pressing the ToggleButton it remained pressed (as it should).

Now, I wanted when the user pressed a different button, the previously pressed button to go to the Default state. Alas, when the new button was pressed, the previous button was in the Default state, but there was a highlight rectangle around it.

Wednesday, April 21, 2010

Hello World!

So, I decided to create this blog for the purpose of posting small solutions to problems I have when coding in .Net. This blog will try to incorporate all things .Net, since it is my primary coding platform.

I hope you find my posts interesting. Comments will be appreciated!

Ioannis Stavrinides