Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Built-in WPF IValueConverters

Tags:

wpf

converters

Ok, it was a nice surprise (after writing it several times) to find that there already is a BooleanToVisibilityConverter in System.Windows.Controls namespace.

Probably there are more such hidden time-savers.

Anyone got some?

like image 751
cz_dl Avatar asked Feb 02 '09 23:02

cz_dl


People also ask

What is value converter in WPF?

A Value Converter functions as a bridge between a target and a source and it is necessary when a target is bound with one source, for instance you have a text box and a button control. You want to enable or disable the button control when the text of the text box is filled or null.

What is IValueConverter?

Introduction. Value converters are used in Data binding. When source object type and target object type are different at that time value converts are used to manipulate data between source and target. Converter class must implement IValueConverter interface.

What is the meaning of WPF?

WPF, stands for Windows Presentation Foundation is a development framework and a sub-system of . NET Framework. WPF is used to build Windows client applications that run on Windows operating system. WPF uses XAML as its frontend language and C# as its backend languages.


1 Answers

I did a quick trawl using the Object Browser and this is what I have.

Derived from IValueConverter:

System.Windows.Controls.AlternationConverter
System.Windows.Controls.BooleanToVisibilityConverter
System.Windows.Documents.ZoomPercentageConverter
System.Windows.Navigation.JournalEntryListConverter

Xceed.Wpf.DataGrid.Converters.CurrencyConverter
Xceed.Wpf.DataGrid.Converters.DateTimeToStringConverter
Xceed.Wpf.DataGrid.Converters.GreaterThanZeroConverter
Xceed.Wpf.DataGrid.Converters.IndexToOddConverter
Xceed.Wpf.DataGrid.Converters.IntAdditionConverter
Xceed.Wpf.DataGrid.Converters.InverseBooleanConverter
Xceed.Wpf.DataGrid.Converters.LevelToOpacityConverter
Xceed.Wpf.DataGrid.Converters.MultimodalResultConverter
Xceed.Wpf.DataGrid.Converters.NegativeDoubleConverter
Xceed.Wpf.DataGrid.Converters.NullToBooleanConverter
Xceed.Wpf.DataGrid.Converters.SourceDataConverter
Xceed.Wpf.DataGrid.Converters.StringFormatConverter
Xceed.Wpf.DataGrid.Converters.ThicknessConverter
Xceed.Wpf.DataGrid.Converters.TypeToBooleanConverter
Xceed.Wpf.DataGrid.Converters.TypeToVisibilityConverter
Xceed.Wpf.DataGrid.Converters.ValueToMaskedTextConverter

Derived from IMultiValueConverter:

System.Windows.Controls.BorderGapMaskConverter
System.Windows.Navigation.JournalEntryUnifiedViewConverter
System.Windows.Controls.MenuScrollingVisibilityConverter

Microsoft.Windows.Themes.ProgressBarBrushConverter
Microsoft.Windows.Themes.ProgressBarHighlightConverter

Note the Xceed ones (no connection) are available free with their DataGrid. As well as those there's some clever stuff around like the debugging converter. I've also used the last IValueConverter and I'm sure there's some further lambda function goodness to be found, too.

like image 52
MrTelly Avatar answered Oct 14 '22 17:10

MrTelly