Automatic properties in .NET 3.5 are a nice thing, but they are out of the equation if you want to take advantage of the almighty INotifyPropertyChanged interface which plays a crucial role in WPF. Here’s a set of ReSharper snippets that simplify interface implementation and property declaration.
Event Declaration
The first snippet just prints out an interface [...]
Monthly Archive for March, 2008
WPF is for LOB - and we can even do RAD (WTF?)
Posted in WPF on Mar 18th, 2008
Agreed - the WPF learning curve is steep, but once one figures out how the basics work, things tend to get amazingly easy. And of course, the emerging sets of toolkits dont’t hurt either.
Here’s another sample - a customer of mine needed a utility to maintain data in their web shop (MySql) and update the [...]
A WPF File Selection control
Posted in WPF Controls on Mar 14th, 2008
This is a pretty simple user control, which allows you to display a file dialog to open or save files. Its look can be easily adjusted, and it provides built-in truncation of the file string to a predefined length if necessary. Here’s the XAML for the above sample control:
<files:FileSelector x:Name=”openFileSelector”
[...]
New Blendables
Posted in WPF Controls on Mar 6th, 2008
Just saw that Blendables have extended their portfolio of WPF controls. The stuff looks good, but unfortunately, their licensing scheme doesn’t:
A license is required for each machine utilizing the blendables controls. [...] As we do not offer a deactivation method, if you must reactivate on a new developer machine you are allowed up to 3 [...]
Preventing WPF TreeView items from being selected
Posted in WPF, WPF Controls, WPF TreeView on Mar 6th, 2008
If you have a WPF TreeView control that shows nested data, and you don’t want the user to select nodes that contain child nodes, you can solve this declaratively as TreeViewItem provides all we need:
HasItems dependency property (bool)
Focusable dependency property (bool)
As both properties have the same type, you can use a binding expression (needs inversion [...]
A KeyedCollection for int keys
Posted in C# on Mar 5th, 2008
I’m using this class so much that I thought I’d share it with you. This generic class is an implementation of the KeyedCollection<TKey, TItem> class for items that have a numeric key:
public abstract class NumericallyKeyedCollection<T> : KeyedCollection<int, T>{ }
Using int-Keys takes a bit more work than other types, because KeyedCollection provides indexers for both key [...]