Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

TimePicker No Select Second

Open netsmallhao opened this issue 1 year ago • 13 comments

why?

netsmallhao avatar Jul 05 '23 13:07 netsmallhao

I believe this control is migrated from winui, the original design is like this. Need some improvement.

rabbitism avatar Jul 05 '23 13:07 rabbitism

I need this, too.

yll690 avatar Jul 06 '23 01:07 yll690

This design is actually unreasonable. It may not take seconds on apps, but selecting seconds on PCs is necessary and switch control can be added

netsmallhao avatar Jul 06 '23 03:07 netsmallhao

I think this should be controllable by a property. I don't know which one would be best. I think either

bool ShowSeconds {get; set;}
enum DisplayMode [hh:mm , hh:mm:ss, ...]

timunie avatar Jul 06 '23 07:07 timunie

Need seconds. Or another type TimePicker with seconds.

PITON369 avatar Jul 28 '23 08:07 PITON369

@maxkatz6 @robloo would either of you be able to confirm this is a wanted feature? I'd love to pick this up next but, just wanted to make sure it is desired and see if there are any guidelines I should follow while implementing it.

lhsrebel72 avatar Aug 08 '23 04:08 lhsrebel72

https://github.com/microsoft/microsoft-ui-xaml/issues/1440

TimePicker was designed to be a time picker, not a duration picker. But it's a reasonable request to have such a control. I just don't know if we should extend TimePicker versus adding a new thing.

So, yes - it is "by design". Can be changed though.

maxkatz6 avatar Aug 08 '23 06:08 maxkatz6

Okay, so for now we need to wait for upstream to decide or for the team to have enough time to decide which API is probably the best for Avalonia. Right now I suggest to write a custom control for your usage. If you want, you can share the control in this issue and if later someone thinks it's the right approach, it still can be merged in.

timunie avatar Aug 08 '23 06:08 timunie

Okay, so for now we need to wait for upstream to decide or for the team to have enough time to decide which API is probably the best for Avalonia.

Well, I don't think we should EVER wait for upstream. WinUI is dying down quite a bit in areas like this. I would be very surprised if there is ever any movement in this space. I do expect they are cooking up several things behind the scenes for Windows 12 though. That said:

Right now I suggest to write a custom control for your usage.

I kind-of agree with this. Second selection is valid in some cases but not for most. I don't think we should complicate the control unless a really good design is found. Perhaps the design is simply to add an optional seconds column which might be fairly straightforward though.

These controls (DatePicker and TimePicker) are also a bit tricky simply due to the way the flyout presenters work. It may not be a great beginning project -- who knows though and I don't want to discourage anything.

Since controls are so widely used I highly suggest providing a visual design for the changes you are proposing and then even a mock-up before any coding here starts.

robloo avatar Aug 08 '23 11:08 robloo

Hi! Is any progress on this? I'm willing to help, if needed. It would be great feature.

mate1213 avatar Jan 11 '24 08:01 mate1213

@mate1213 I think my comment is still valid: https://github.com/AvaloniaUI/Avalonia/issues/12045#issuecomment-1669013425

So I see 2 options you can help:

  1. create your own control extending the original control with these properties added. Would be great if you share the code here.
  2. Clone Avalonia and work on the implementation proposal and file a PR for us to review when we find the time to do so. (knowing it may be rejected in the worst case). The PR will crteate a nuget package for anyone to test.

If you go with 2), make sure to read build instructions.

timunie avatar Jan 11 '24 08:01 timunie

Great! Will try to do it the proper 2nd way. :D I will check in when I started.

mate1213 avatar Jan 11 '24 08:01 mate1213

Just dropping in to say I need a TimePicker that supports seconds too and was quite surprised to see that this isn't a supported feature of TimePicker.

begleysm avatar May 09 '24 20:05 begleysm

I've submitted PR https://github.com/AvaloniaUI/Avalonia/pull/16079 that adds a new UseSeconds Property (that defaults to false keeping existing usages of TimePicker unaffected) that displays a Seconds column in the TimePicker Control when set to true.

begleysm avatar Jun 20 '24 19:06 begleysm