kaban
Topic Author
Posts: 17
Joined: 22 Sep 2013, 09:35

Using value converters in Unity?

11 Feb 2014, 12:01

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?
 
User avatar
jsantos
Site Admin
Posts: 3805
Joined: 20 Jan 2012, 17:18
Contact:

Re: Using value converters in Unity?

12 Feb 2014, 01:54

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!

Who is online

Users browsing this forum: Bing [Bot] and 7 guests