Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Small fix for setting the DateTimeFormat of an NZazu date-Field #96

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion NZazu.Xceed/XceedDateTimeField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ protected override Control CreateValueControl()
var control = new DateTimePickerWithUpdate { ToolTip = Definition.Description, Watermark = Definition.Hint };

// set date time format
DateFormat = Definition.Settings.Get("Format");
DateFormat = Definition.Settings.Get(nameof(control.Format));
// ReSharper disable once InvertIf
if (!string.IsNullOrWhiteSpace(DateFormat))
{
control.Format = DateTimeFormat.Custom;
control.FormatString = DateFormat;

if (Definition.Settings.ContainsKey(nameof(control.Format)))
{
Definition.Settings[nameof(control.Format)] = Enum.GetName(typeof(DateTimeFormat), DateTimeFormat.Custom);
}
}

return control;
Expand Down