Here, we will create a new PropertyValueEditor, which will allow us to slide the slider to chnage the property value. If your property is a double type with specified minimum and maximum boundaries, we can use the slider propertyvalueeditor for easy access of the property.
In my custom activity, I have the RepeatCount property, where I used the Slider Property Value Editor.
Bound the PropertyValueEditor to the Property
[Editor(typeof(PropertyEditors.CustomSliderPropertyValueEditor), typeof(ExtendedPropertyValueEditor))]
public double RepeatCount { get; set; }
Custom Slider PropertyValueEditor Code:
public class CustomSliderPropertyValueEditor: PropertyValueEditor
{
public CustomSliderPropertyValueEditor() ();
{DataTemplate customTemplate= new DataTemplate
FrameworkElementFactory stack = new FrameworkElementFactory(typeof(StackPanel ));
FrameworkElementFactory slider = new FrameworkElementFactory(typeof(Slider ));
Binding sliderBinding = new Binding(“Value” );
sliderBinding.Mode =BindingMode .TwoWay;
slider.SetValue(Slider .MinimumProperty, 0.0);
slider.SetValue(Slider .MaximumProperty, 100.0);
slider.SetValue(Slider .ValueProperty, sliderBinding);
stack.AppendChild(slider);
FrameworkElementFactory textb = new FrameworkElementFactory(typeof(TextBox ));
Binding textBinding = new Binding(“Value” );
textb.SetValue(TextBox .TextProperty, textBinding);
textb.SetValue(TextBox.IsEnabledProperty, false );
stack.AppendChild(textb);
this .InlineEditorTemplate = customTemplate;
this .InlineEditorTemplate.VisualTree = stack; }
}