views:

22

answers:

1

I store True/False values as bit fields in SQL Server. The fields are nullable. What is the XAML syntax to bind a bit field to a WPF combo box so the user can choose True/False or blank (null)?

By the way, I'm binding to a strongly-typed dataset/datatable. Drag and drop binding has simplified binding to other datatypes. I certainly don't mind editing the XAML, but I'm wondering if drag and drop can be made to work in this scenario?

A: 

You will likely need to create a value converter (a class which implements the IValueConverter interface) which can translate the value of a bit field to a boolean value. Part of the problem, out of the box, is that how do you represent a null value as a boolean state? That typically depends on the business process or rules.

Hugo