XamComboEditor / ComboEditorTool Setting Default Text

Want to have default text shown when no item is selected in a combo box, such as “Please Select”? This can easily be achieved using a binding converter such as:

	public class NullConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (value == null)
			{
				return "Please Select";
			}
			else
			{
				return value;
			}
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (value is string && ((string)value) == "Please Select")
			{
				return null;
			}
			else
			{
				return value;
			}
		}
	}

Then in your XAML it can be used like this:


<Window.Resources>
    <igEditors:ComboBoxItemsProvider  x:Key="ComboItemsProvider" ItemsSource="{Binding Path=Data}" />
    <local:NullConverter x:Key="nullConv" />
</Window.Resources>

<igEditors:XamComboEditor ItemsSource="{Binding Path=Data}"
                          Text="Please Select"
                          SelectedItem="{Binding Path=SelectedItem,Converter={StaticResource nullConv}}"/>