Page 1 of 1

Using value converters in Unity?

Posted: 11 Feb 2014, 12:01
by kaban
I'm trying to create a float scaler which takes in a float value and multiplies it by a number of my choosing in xaml.

I've tried setting up the following converter:
using Noesis;
using System.Globalization;

namespace GameUI
{
    //[ValueConversion(typeof(DateTime), typeof(String))]
    public class FloatScalerConverter : BaseValueConverter
    {
        public object Convert(object value, System.Type targetType, object parameter)
        {
            return (float)value * (float)parameter;
        }

        public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture)
        {
            return (float)value / (float)parameter;
        }
    }
}
Which I've added to the blend project but because noesis is not referenced in the assembly it doesn't work, I'm not sure there is a noesis dll I could add to the blend project at all?

Re: Using value converters in Unity?

Posted: 12 Feb 2014, 01:54
by jsantos
Hi,

I am sorry to say that for now Converters are only available in C++, not Unity (C#). If this is important to you, please, file us a ticket to tracks this.

Thanks!