WPF: Window Dock Behavior


**updated this post for Blend 3 RC release

Have you ever used WinSplit Revolution? It’s a utility that helps you organize your windows into regions to assist with organizing your screen real estate. I find this to be a very useful tool, especially when I use two monitors while doing development, being able to organize my windows neatly makes a huge difference. One cool feature is called Drag’n’Go. When you drag your window outside your screen boundary, a semi-transparent rectangle (I’d like to call it an overlay) appears to cue you on the location of where the window will be docked. I really like this feature, and wondered how difficult it would be to incorporate this into a Behavior for a Window class in WPF to exhibit the same kind of functionality. Here’s my result.

DockWindow

Read the rest of this entry »

Advertisements
Posted in WPF. Tags: . 2 Comments »

WPF: Editable Behavior for Labels


** updated this post for Blend 3 RC release
I’ve worked on a couple of business applications at work and whether it’s Web or Desktop, you almost always require some sort of view page/screen to see the data you asked for, e.g. customer details, order details…etc. Not surprisingly, there’s usually a corresponding Edit page/screen to allow users to modify the same details. What this means is that you will be required to develop two sets of screens for the same data, one to view and one for users to edit. In some cases, the two screens can be the same in terms of layout, with the exception of using Labels for viewing and Textboxes, Dropdowns..etc for editing. Is there a way we can avoid having two screens?

Read the rest of this entry »

Posted in WPF. Tags: . 5 Comments »

WPF: ItemsControl Drag Drop Behavior


** updated this post for Blend 3 RC release

In my previous post, I talked about adding Drag and Drop functionality into controls that implement ItemsControl via a Decorator pattern. In that DragDrop Decorator, I have created a Drag Adorner to create a visual effect of the actual item you are dragging. In this post I have added a new functionality where you can see an Insert Adorner that shows you the position you are attempting to add the item to. Since a picture tells a thousand words….

Read the rest of this entry »

Posted in WPF. Tags: . 11 Comments »

WPF Body Behavior


Recently after looking at the Remix 09 videos that was held in Sydney, I learned about heaps of interesting new features in Silverlight 3. One of these is Behaviors. Behaviors are self-contained, reusable snippets of code that implements certain functionality, and can be attached to UI elements. Think of it as plug-in. It’s been created by the Expression Blend team, and lives in the Microsoft.Expression.Interactivity namespace. There are some nice samples available from the Expression Gallery, some of them are really cool. I took a particular interest in the BodyBehavior, which morphs a UI element into a physics-aware entity. It becomes a solid entity and can interact with other entities via collisions, bouncing and gravity, etc.

Read the rest of this entry »

Posted in WPF. Tags: . Leave a Comment »