Dynamic type binding in WPF 4.5

One of the new features in WPF 4.5 is data-binding support for ICustomTypeProvider. This enables adding dynamic properties to types where the actual shape of the type is not known until runtime. For example, where the data itself is being retrieved from a web service (JSON) or from an XML definition. This feature was also added in Silverlight 5 so we have feature parity here (almost). ICustomTypeProvider allows you to define the bindable properties at runtime with full type knowledge … [Read more...]

INotifyPropertyChanged in .NET 4.5

Implementing INotifyPropertyChanged in your XAML-based application has always been a point of hot debate. To date there are a variety of techniques - from the original (and fastest) "magic" string indicating the property name to the much slower, but compiler-checked Lambda expression tree implementation which provides refactoring safety. Both styles are included in my MVVM library (http://mvvmhelpers.codeplex.com). Trying to keep the performance of a raw string-based approach, but get the … [Read more...]

Dot-plotting with .NET Bio

One of the most common analysis done with genetic sequences is a dot-plot.  This is where we plot two sequences against each other – in the X and Y direction to get a sense of the similarity between them.  The dot-plot provides a simple, visual tool which can quickly identify consensus between the sequences.  While it was originally developed for the genetic field, the actual concept can be applied to any style of data – allowing professors to detect plagiarism for example. .NET Bio doesn’t … [Read more...]

WPF + Prism + Biology!

I spend a lot of time in WPF – both in teaching it around the world, and also in assigning in development of applications for various companies.  I also work a bit in the Bioinformatics space – doing applications and research in genomics.  This post is the start of a series which will combine these efforts and attempt to give others some helpful ideas on doing bioinformatics with .NET – and creating visualizations with WPF! .NET and Biology? To start out, let me introduce a somewhat unknown … [Read more...]

Removing the Close Button on a WPF window

Today I was building a simple simulator to test some events to a new piece of hardware I’m working on.  Of course, I’m using WPF to show the simulator – and I wanted to create a topmost window that did not have a Close button on it.  Imagine my surprise when I realized there was not a set of flags you could supply to the Window object to actually achieve this result! However, with a little Win32 mojo we can get the desired effect: public partial class MainWindow{    … [Read more...]

rCAT 2.0 is online, 3.0 is coming

The main project I’ve been working on the past few months has been a rRNA sequencing application.  It’s a joint project involving Microsoft Research and the University of Texas in Austin.  The goal being to produce lightning fast visualizations (nucleotide, 2D and 3D) with very large (100,000 sequence) data sets on WPF.  It’s been a big learning experience for me in many ways because the traditional mechanisms for dealing with things in WPF just flat out fail when we load big … [Read more...]

MVVM: Rename TreeView nodes

I know I said I was going to cover some services next, but I got a request last night to show how to rename TreeView nodes (ala Explorer) using the MVVM pattern in WPF.  The solution is quite easy and elegant and I thought I’d share it here. First, the idea is we want to be able to double-click on the text portion of the TreeViewItem and have it allow us to type in a new name, replacing the current text.  This involves changing the visual template out (from a TextBlock to a TextBox) … [Read more...]

MVVM: Views and ViewModels

In the previous post, I provided a link to the project template you can use to start a new MVVM project using the JulMar MVVM library. Here's the two links in case you didn't get them before: MVVM Helpers Distribution Project Template Copy the project template into your Visual Studio 2008 templates directory located off your user documents - mine is at %UserProfile%DocumentsVisual Studio 2008TemplatesProjectTemplatesVisual C#Windows. Ok, so once you have these installed, what can you do with … [Read more...]

Deferred bindings in WPF (ala Deferred Scrolling)

One of the new features added to WPF 3.5 SP1 was the ScrollViewer.IsDeferredScrollingEnabled property which allows you to scroll through large amounts of data without taking the actual scrolling hit until the user stops moving the scroll thumb.  This is essential when you have complex visualizations, or if the data itself is virtualized and the load time is expensive.  You can get information on this feature … [Read more...]

Correcting the WPF Themes

I'm a big fan of themes in WPF -- and I think it's great that Microsoft has released a whole set of themes for Silverlight and WPF at www.codeplex.com/wpf However, in using some of those themes, I've run into an annoying bug in the RadioButton template - specifically, the checked state doesn't always show up initially.  Looking at the template, it turns out to be an easy fix.  The "CheckIcon" is set to an opacity of zero initially (so it's not shown) and then a trigger is used to apply … [Read more...]