Skip to content

A kind of progress bar containing hot spots and time scale.

cs
[TemplatePart(Name = ElementBorderTop, Type = typeof(Border))]
[TemplatePart(Name = ElementTextBlockMove, Type = typeof(TextBlock))]
[TemplatePart(Name = ElementTextBlockSelected, Type = typeof(TextBlock))]
[TemplatePart(Name = ElementCanvasSpe, Type = typeof(Canvas))]
[TemplatePart(Name = ElementHotspots, Type = typeof(Panel))]
public class TimeBar : Control

Attributes

PropertyDescriptionDefault ValueRemarks
HotspotsHot Spot Collection
HotspotsBrushHot Spot Color
ShowSpeStrWhether to show the scalefalse
TimeFormatTime Formatyyyy-MM-dd HH:mm:ss
SelectedTimeCurrently selected time
SpeStr

Events

NameDescription
TimeChangedTriggered when the selected time changes

Case

xml
<hc:TimeBar BorderThickness="0" Width="600"/>

TimeBar

Set hot zone

cs
for (int i = 0; i < 10; i++)
{
    var hour = 6 * i;
    TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(hour), DateTime.Today.AddHours(hour + 1)));
    TimeBarDemo.Hotspots.Add(new DateTimeRange(DateTime.Today.AddHours(-hour), DateTime.Today.AddHours(-hour + 1)));
}

Released under the MIT License.