Topic Author
Posts: 14
Joined: 08 Dec 2018, 07:50

Slider control: Print the slider value at the same time when sliding??

20 Dec 2018, 20:46

Hi, i'm using NoesisGUI for unreal and I'm trying to use a slider control in my XAML file.
What I want is to continously use the value of a slider(say..print string) when I'm changing the value.
I tried by using "ValueChanged" to create a binding SliderChanged and created the same named function in my NoesisView in unreal, but it does not work.
<Slider HorizontalAlignment="Left" Margin="84,80,0,0" VerticalAlignment="Top" Height="40" Width="191" Value="{Binding XValue, Mode=OneWayToSource} ValueChanged="{Binding SliderChanged}"/>

The same works for a button if I use its "Command" property for binding.

Is there anything I'm missing here?

User avatar
Site Admin
Posts: 236
Joined: 09 Feb 2012, 12:40

Re: Slider control: Print the slider value at the same time when sliding??

21 Dec 2018, 12:11

Hi shiaro007,

ValueChanged in a Slider is an event, and an event cannot be set to a Binding in XAML. Command in a button, on the other hand, is a DependencyProperty of type ICommand, that can be set to a Binding.

However, you can use our EventToCommand class in Noesis SDK 2.1 to achieve what you want like this:
    xmlns:d="" xmlns:mc="" mc:Ignorable="d"
    <Slider Value="{Binding Value}" noesis:EventToCommand.Event="ValueChanged" noesis:EventToCommand.Command="{Binding ValueChanged}"/>
Please, take into account that this will be superseded on version 2.2 by the more powerful functionality in the Interactivity framework. After version 2.2 you will be able to do the same with the following XAML:
    xmlns:d="" xmlns:mc="" mc:Ignorable="d"
    xmlns:i="" xmlns:ei="">
    <Slider Value="{Binding Value}">
            <ei:EventTrigger EventName="ValueChanged">
                <i:InvokeCommandAction Command="{Binding ValueChanged}"/>
I've attached a small Blueprint only sample that shows how to do it.
(12.55 KiB) Downloaded 83 times

Who is online

Users browsing this forum: No registered users and 2 guests