Esempio n. 1
0
        public IntegerSlider(Core.VplControl hostCanvas)
            : base(hostCanvas)
        {
            AddOutputPortToNode("Number", typeof(int));

            SliderExpanderInteger expander = new SliderExpanderInteger
            {
                Style       = hostCanvas.FindResource("ExpanderSliderStyleInteger") as Style,
                SliderValue = 5,
                SliderMax   = 10,
                SliderMin   = 0,
                SliderStep  = 1
            };

            var b2 = new Binding("Data")
            {
                Mode   = BindingMode.OneWayToSource,
                Source = OutputPorts[0]
            };

            expander.SetBinding(SliderExpanderInteger.SliderValueProperty, b2);

            Name = "Integer slider";

            AddControlToNode(expander);
        }
Esempio n. 2
0
        public IntegerPort(string name, PortTypes portType, Type type, VplControl.Core.VplControl hostCanvas) : base(name, portType, type, hostCanvas)
        {
            // Set the DataType
            DataType = typeof(int);

            integerSlider = new SliderExpanderInteger
            {
                Style       = hostCanvas.FindResource("ExpanderSliderStyleInteger") as Style,
                SliderValue = 5,
                SliderMax   = 10,
                SliderMin   = 2,
                SliderStep  = 1
            };

            if (Data != null)
            {
                integerSlider.SliderValue = (int)Data;
            }

            var binding = new Binding("Data")
            {
                Mode   = BindingMode.OneWayToSource,
                Source = this
            };

            integerSlider.SetBinding(SliderExpanderInteger.SliderValueProperty, binding);
            AddPopupContent(integerSlider);
        }