How do I find it belongs to?

Hi,

I have many switch and slider. I want to control each of switch/slider properties. How can I do?

<App Theme="Basic"> 

    <JavaScript>
        var Observable = require("FuseJS/Observable");

        var data = Observable(
            {name: "foo", dim_value: 10},
            {name: "bar", dim_value: 70},
            {name: "xoo", dim_value: 0},
            {name: "zoo", dim_value: 110},
            {name: "foo.2", dim_value: 10},
            {name: "bar.2", dim_value: 210},
            {name: "xoo.2", dim_value: 0}
            );

        module.exports = {
            data: data,
            switchChanged: function (args) {
                console.log("Switch value is: " + args.value);
            }

        };
    </JavaScript>

    <Panel ux:Class="MyPanel" Height="35" Margin="5,10" />

    <ScrollView>
        <Grid>
            <Each Items="{data}">
                <DockPanel Height="50" Margin="10,5">
                    <MyPanel>
                        <Text TextColor="#fff" Alignment="VerticalCenter" Value="{name}" />
                    </MyPanel>
                    <MyPanel>
                        <Slider Alignment="Center" Padding="5,10,10,10" Width="150" Value="{dim_value}" Minimum="0" Maximum="255" />
                    </MyPanel>

                    <MyPanel>
                        <Switch Value="False" ux:Name="TheSwitch" ValueChanged="{switchChanged}" Alignment="CenterRight" />
                        <WhileFloat Value="{dim_value}" GreaterThan="1" LessThan="255">
                            <Change TheSwitch.Value="True" />
                        </WhileFloat>                    </MyPanel>

                    <Rectangle Layer="Background" CornerRadius="15" Fill="#975A5E" />
                </DockPanel>
            </Each>
        </Grid>
    </ScrollView>

</App>

Console

LOG: Switch value is: true The results of which Switch?

Hi!

args.data identifies the object from your observable list that corresponds to the slider :slight_smile:

I love Fuse!