I have a TimePicker
declared in my XAML view:
<xctk:TimePicker Grid.Column="5" Value="{Binding TimeFrame}" StartTime="00:00:0" EndTime="23:59:0" Format="Custom" FormatString="HH:mm" Margin="3 3 3 0" MinWidth="100"/>
Which binds to this TimeFrame
method in my view model class:
private DateTime _timeFrame;
public DateTime TimeFrame
{
get { return _timeFrame; }
set
{
if (value != _timeFrame)
{
_timeFrame = value;
OnPropertyChanged("TimeFrame");
}
}
}
Is there a way to limit the dropdown to only 30 min intervals e.g. 07:00:00, 07:30:00 08:00:00 08:30:00 etc. ? I've tried setting TimeInterval
property shown at https://github.com/xceedsoftware/wpftoolkit/wiki/TimePicker to TimeInterval="30"
, but this seems to just only keep 00:00:00 in the dropdown.
I could make my own custom user control to do this, but it would be nice to make it work with this toolkit.
Ok I've just found the issue.
You need to use full HH:mm:ss
format:
TimeInterval="00:30:00"
Instead of:
TimeInterval="30"