Which namespace/DLL to use for ValueConversion in

2019-09-18 20:18发布

问题:

I am converting a SL3 application to SL4 and facing some issues.

Can anyone provide me the namespace or DLL name for ValueConversion.

I am getting error on the following statement.

[ValueConversion(typeof(ToolType), typeof(bool))]

Thanks for sharing your time.

回答1:

This class is not part of Silverlight Runtime Classes now. it was there in System.Windows.Data namespace before. Ref: http://msdn.microsoft.com/en-us/library/system.windows.data.valueconversionattribute.aspx

you can use IValueConverter interface as before.



回答2:

I use the following implementation in ClipFlair Studio: http://ClipFlair.codeplex.com (see Client/Helpers/WPF_Compatibility/WPF_Compatibility.Silverlight project at the sourcecode)