Thrash505’s Code Blog

July 9, 2009

WpfSplitButton – Version 1.0.0.2 (coming soon…)

Filed under: C#, WPF — Tags: , , , — thrash505 @ 2:49 pm

I’ve started to use my WpfSplitButton control in one of my projects and I’m discovering some difficulties and/or inconveniences with it. I’m now resolving some of those issues and will release an update in a few days.

(more…)

WPF – Selector/ListBox/ListView/TabControl – Auto-Select First Item Using XAML

Filed under: C#, WPF — Tags: , , , , , — thrash505 @ 1:31 pm

When your application has a control on it that derives from Selector and has no items on load nothing is selected, obviously. During run-time when the user is clicking around and adds items to the Selector-derived control, you would assume that the control would automatically select the first item because that only makes sense. However, your assumption and mine would be wrong; this is not the behavior at all. Instead the selector will still have no items selected. This means in order to get this “Auto-select first item” behavior, you have to do it yourself. I’ve came up with a simple solution to this problem using only XAML.

(more…)

July 6, 2009

WpfMessageBar – Version 1.0.0.0 Released on CodePlex

Filed under: C#, WPF — Tags: , , , — thrash505 @ 4:31 pm

I’ve always disliked dialog boxes… especially ones that only have an “OK” button on it. These sorts of dialog boxes are not very helpful because they stop the user in there tracks to tell them something and then force them to click “OK”. I really don’t like that scenario so I came up with an alternative method of accomplishing the same thing in what I think is a better way.

Its called a message bar and by default it sits on the bottom of a window where the status bar would normally be. When the program needs to subtly tell the user something and the user doesn’t have to make an immediate decision, you can use the message bar. It is not meant for letting the user take an action… so no “Do you want to save?” scenarios. I like this approach better because it still draws attention, but doesn’t stop the user from what there trying to do. Use it when saving to a file failed, when there network connection drops, when they entered an invalid value, etc.

All the details, source code, samples, and screenshots can be found at: http://wpfmessagebar.codeplex.com/

June 24, 2009

WPF SplitButton – Version 1.0.0.1 Released on CodePlex

Filed under: C#, WPF — Tags: , , , — thrash505 @ 11:04 am

I’ve released version 1.0.0.1 of the SplitButton control for WPF on CodePlex: http://anothersplitbutton.codeplex.com/ The details of the changes can be found there or on my previous post as well. If you have any suggestions for the control please feel free to express them on the CodePlex site.

June 22, 2009

WPF SplitButton Update

Filed under: C#, WPF — Tags: , , , — thrash505 @ 12:24 pm

I added a new DependencyProperty for the SplitButtonHeader control called PastLeftDetection. When set to True, any MouseDown past the left of the drop-down initiator (but still on the SplitButton), will cause it to re-route the MouseDown to the DropDownInitiator instead. This will now be the default behavior for SplitButtonHeader because it gives the user their intended result. Also, there are now XML comments for basically everything in the project now.

I’ll release an update on CodePlex in the next few days. If you need the update now, just add a comment to this post or on CodePlex.

June 19, 2009

WPF SplitButton control release on CodePlex

Filed under: C#, WPF — Tags: , , , — thrash505 @ 3:46 pm

I’ve been working on a WPF SplitButton control for the past few days and I finally have a stable, open source, lookless version available on CodePlex. The project and all details can be found here: http://anothersplitbutton.codeplex.com/

June 12, 2009

ArrayCasting Helper Class

Filed under: C# — Tags: , , — thrash505 @ 11:09 am

I’ve found myself in the situation where I have an array of objects that I want to cast into an array of some other type. You’d think that this would be as simple as: (TheType[])objectArray, but unfortunately, one way or another, you have to loop through each object and cast it into the new type. This becomes a pain when you need to do it frequently.

(more…)

May 21, 2009

Frame-Based Animation In WPF

Filed under: C#, WPF — Tags: , , , — thrash505 @ 5:32 pm

Introduction

In WPF most animations are time-based, using storyboards to animate a objects properties over a certain period of time. That is great and works well, until an artist hands you a stack of images that are to be used as individual frames of an animation. This is my current situation, so I spent an hour or two trying to figure out a way to accomplish frame-based animations in WPF. This is what I came up with…

(more…)

Blog at WordPress.com.