public static UserControl CreateSolarTermBar(int year, double timeZone, FontFamily fontFamily) { UserControl uc = new UserControl(); Grid grid = new Grid(); grid.SnapsToDevicePixels = true; DateTime dateTime = new DateTime(year, 1, 1); var todaySolarTermIdx = LuniSolarDate <VietnameseLocalInfoProvider> .GetSolarTermIndex(DateTime.Today); for (int i = 0; i < 24; i++) { var idx = (24 + i - 5) % 24; dateTime = Sun.GetDateTimeOfSolarTerm(idx, year).AddHours(timeZone); grid.ColumnDefinitions.Add(new ColumnDefinition()); var rec = CreateRectangle(idx, dateTime, "", fontFamily); if (DateTime.Today.Year == year && todaySolarTermIdx == idx) { rec.Name = CURRENT_TERM_LABEL; } Grid.SetColumn(rec, i); grid.Children.Add(rec); } uc.Content = grid; return(uc); }