![]() | Date |
The DateTimeSource type exposes the following members.
Name | Description | |
---|---|---|
![]() | DateTimeSource | Initializes a new instance of the DateTimeSource class. |
Name | Description | |
---|---|---|
![]() | Now | Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time. |
![]() | Today | Gets the current date. |
![]() | UpdateInterval | Gets or sets the interval in which the PropertyChanged event is raised for all properties. |
![]() | UtcNow | Gets a DateTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC). |
Name | Description | |
---|---|---|
![]() | Finalize |
Finalizes an instance of the DateTimeSource class.
(Overrides Object.Finalize()) |
Name | Description | |
---|---|---|
![]() | PropertyChanged | Occurs when a property value changes. |
Name | Description | |
---|---|---|
![]() ![]() | Default | The default singleton object. Use this as a source for binding that supports manual updating. |
Name | Description | |
---|---|---|
![]() | SafeCast<T> |
Performs a cast from object to T, avoiding possible null violations if T is a value type.
(Defined by ObjectExtensions) |
MyDayOfWeek="{Binding Path=DayOfWeek, Source={x:Static system:DateTime.Today}}"
Using DateTimeSource instead, UpdateTarget() will work, and MyDayOfWeek will be updated with the actual value:
MyDayOfWeek="{Binding Path=Today.DayOfWeek, Source={x:Static toms:DateTimeSource.Default}}"
Another usage is to use a local instance with timer triggered property change events:
<FrameworkElement.Resources> <toms:DateTimeSource x:Key="TimeSource" UpdateInterval="00:00:01" /> </FrameworkElement.Resources> ... <TextBox Text=Binding Path=Now, Source=StaticResource TimeSource}}" />