Page 1 of 1

How to connect a slider event

Posted: 07 Apr 2020, 09:58
by tesrt
How can I connect a slider event in C# to Noesis ?
The code I have bellow
        
        protected override bool ConnectEvent(object source, string eventName, string handlerName)
        {
            if (eventName == "ValueChanged" && handlerName == "Slider_ValueChanged")
            {
                ((Slider)source).ValueChanged += this.Slider_ValueChanged;
                return true;
            }

            return false;
        }
says
No overload for 'Slider_ValueChanged' matches delegate 'RoutedPropertyChangedEventHandler<float>'

Re: How to connect a slider event

Posted: 07 Apr 2020, 14:09
by sfernandez
In Noesis our properties use float instead of double compared to WPF.
As you can see in our BlendTutorial sample we define the appropriate type depending on the compilation target, Noesis or Blend:
#if NOESIS
using Noesis;
using Float = System.Single;
#else
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Float = System.Double;
#endif
Then use that define in the function signature:
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<Float> e)