WpfMaterialForms icon indicating copy to clipboard operation
WpfMaterialForms copied to clipboard

Feature suggestions and roadmap

Open edongashi opened this issue 7 years ago • 18 comments

    • [x] Datepicker support (e608c829c32cf81afc549b0d3d6542628ec24323)
    • [x] Create a wiki page (7ac3e09688fba5115e65c5fc4fef8dd59301272f)
    • [x] Password fields (1a811a8974e5ec118860e04934caf6077a30764e)
    • [ ] Utilities for managing dialogs: displaying, closing, session (WIP)
    • [ ] Textbox masking support
    • [ ] More customizable data conversion for converted fields (numeric, custom dates)
    • [ ] Timepicker support, maybe a control with both date and time
    • [ ] Progressbar fields (Loading buttons are supported)
    • [ ] Move Mappers to a library and allow integration through hooks (opt-in gives performance benefits and minimizes dependencies of core lib)
    • [ ] Create a library for JavaScript support and allow injecting JS such as [ScriptAction("INCREMENT", "this.Counter++")]
    • [ ] Keep track of and implement controls uniformly for all themes
    • [ ] An option to disable the entire form when processing data.

edongashi avatar Dec 01 '17 10:12 edongashi

Hey, I ran into this problem recentlty and I think it's a good idea: Add a attribute to override the type builder, for example I needed a DateTimePicker but with a mask, so I had to use a ConvertField but there was no way to override it, so I manually changed it.

redbaty avatar Dec 04 '17 12:12 redbaty

Is it possible to use a mask with the calendar picker control? Do we need to modify the underlying textbox via template, or is there an easier way?

edongashi avatar Dec 04 '17 16:12 edongashi

I believe we can't use masks on calendars (Not sure tho), what I meant was something like

[Override(typeof(ConvertedField))]
public DateTime Date { get; set; }

and it would force the builder to use the specified type

redbaty avatar Dec 04 '17 17:12 redbaty

I looked at the code but this seems quite difficult, since lookup is done in a forward fashion from prop/type to builder. Forcing a specific type would require runtime checking (builders can be added or removed, this can cause unexpected states).

A simple solution would be adding a new builder for DateTime..

FormBuilder.Default.TypeBuilders[typeof(DateTime)].Insert(0, new CustomDateBuilder(...)))

where CustomDateBuilder checks some condition. If that condition matches (for example [Masked]) then return a converted field, else return null to pass.

edongashi avatar Dec 04 '17 17:12 edongashi

Hey, just leaving it here to try to make it later:

  • Add some kind of class mapper like Mapper<TClass> to map from a class extension or at runtime (Or both). I think this is going to take some time
  • Expose DialogHost to change CloseOnClickAway property

redbaty avatar Dec 20 '17 17:12 redbaty

What is the mapper stuff about? I checked the code, something like proxying objects?

edongashi avatar Dec 20 '17 23:12 edongashi

@EdonGashi Hey I was taking a look on the progress bar stuff and tough to myself: We could implement the progress button from MaterialDesignInXamlToolkit, this would be great for forms that need to do some async stuff like HTTP. Oh and I've changed this thread style and added [Password] support 🎉

redbaty avatar Dec 26 '17 18:12 redbaty

Thanks @redbaty for all the effort. The button would definitely be nice for async actions. There is also a stepper control which would be. :fire: if we could integrate that in a nice way.

An idea:

[Step("Personal details.")]
public string Name ...
public DateTime DoB...

[Step("Billing information")]
public string CardNumber ...
...

edongashi avatar Dec 26 '17 23:12 edongashi

@EdonGashi Yeah the stepper would be really nice, I think I'll try to introduce the loading button and the progress bar tomorrow and in the next days I'll take a look on how we could do the stepper thingy. But anyway this is a really great library, I should be the one thanking you! 😄

redbaty avatar Dec 26 '17 23:12 redbaty

Suggestions

[Submit] Attribute

This can be used alongside the [Field] attribute to listen to the keyup event and act as a [Action] attribute. @EdonGashi any idea how we would implement this? Is there a common presenter for fields?

redbaty avatar Jan 08 '18 23:01 redbaty

For fields such as StringField the hierarchy goes like this:

StringField : DataFormField : FormField : FormElement

DataFormField should handle Read-Write props. Regarding the views generated I'm not sure how we can extract something in common, a place to consider would be IBindingProvider, which gets bindings for fields.

I'm not quite sure I understand the meaning behind [Submit], something like dispatch an action when the field changes? Could something like [Field(OnChange=...)] work? Otherwise we can always put classic setters in properties:

public string Something
{
  get
  {
    return something;
  }
  set
  {
    something = value;
    OnSomethingChanged();
  }
}

edongashi avatar Jan 09 '18 09:01 edongashi

@EdonGashi Sorry I thought I had written it, I mean to submit this form when someone press "enter", this should work similar to the [Action] attribute

redbaty avatar Jan 09 '18 10:01 redbaty

[Action(IsDefault = true)] should trigger on enter. Could you test this quickly?

edongashi avatar Jan 09 '18 10:01 edongashi

@EdonGashi Yup just a sec

redbaty avatar Jan 09 '18 10:01 redbaty

@EdonGashi Using the following does not work.

[Action("ok", "Entrar", IsLoading = "{Binding IsLoading}", IsDefault = true)]

redbaty avatar Jan 09 '18 10:01 redbaty

Looks like this property exists in the attribute but it's not added in ActionElement. It needs to have a

public IValueProvider IsDefault { get; set; }

public IValueProvider IsCancel { get; set; }

which should be initialized from the attribute and then added to resources on Freeze(). After this the button in the template should do IsDefault={FormBinding IsDefault} and IsCancel={FormBinding IsCancel}

edongashi avatar Jan 09 '18 10:01 edongashi

@EdonGashi Hmmm, I've added it but it still won't work, am I missing something? Check it out on 40d810bf3fd4bb789b27b2acfab42fd26543db95

redbaty avatar Jan 09 '18 14:01 redbaty

Fixed, ActionAttribute didn't initialize the values. Also removed those fields from ActionElementCommand because it doesn't need them.

During a Freeze() the resources are linked to their names, which can then be accessed using {FormBinding ResourceName}

edongashi avatar Jan 09 '18 17:01 edongashi