WpfMaterialForms icon indicating copy to clipboard operation
WpfMaterialForms copied to clipboard

NumberRange in dynamic forms

Open hashitha opened this issue 7 years ago • 5 comments

is NumberRange available for DynamicForms?

hashitha avatar Dec 20 '17 09:12 hashitha

I don't think so, as WPF does not officially support it, though we could implement it. You can bind it to a integer and specify its range too.

redbaty avatar Dec 20 '17 10:12 redbaty

Sorry, I meant to have a slider like in the old demo volume slider which uses NumberRangeSchema

image

hashitha avatar Dec 20 '17 10:12 hashitha

@hashitha Oh alright, yes I think we missed it (Although we need @EdonGashi to confirm it). Either way, this doesn't seem difficult to implement, I'll try to add it to my fork later.

redbaty avatar Dec 20 '17 11:12 redbaty

A [Slider] attribute should be a good fit for this control. Basically we add a PropertyBuilder that checks for this attribute and returns the respective control.

For xml we can do something like

<!-- Instead of input we do slider-->
<input type="int" ... />
<slider type="int" ... />

<!-- We also need support for a select tag -->
<select type="string" from="{Binding Items}" />
<select type="string">
  <option value="Option 1" />
  <option value="Option 2" />
  <option value="Option 3" />
</select>

Besides xml support new controls must also support metro and wpf. So we must consider 4 implementations for each new field type. Takes a little more time but nothing undoable.

edongashi avatar Dec 20 '17 16:12 edongashi

Added [Slider(Minimum = ..., Maximum = ..., IsDiscrete = ....)] IsDiscrete is not yet implemented.

Check Settings model for demo

edongashi avatar Dec 22 '17 03:12 edongashi