RadTimeBar with Non-Gregorian Calendar

1 Answer 103 Views
TimeBar
Liam
Top achievements
Rank 1
Liam asked on 19 Aug 2021, 07:28 AM

Does the RadTimeBar support when Windows has a non-Gregorian calendar set? Specifically this one: https://docs.microsoft.com/en-us/dotnet/api/system.globalization.umalquracalendar?view=net-5.0. I get an exception that says this when I change my Windows settings to get that calendar:

Exception Stack Trace: System.Windows.Markup.XamlParseException: Specified time is not supported in this calendar. It should be between 04/30/1900 00:00:00 (Gregorian date) and 11/16/2077 23:59:59 (Gregorian date), inclusive.

I can reproduce it with XAML as simple as this:

		<telerik:RadTimeBar x:Name="TimeBar"
                            PeriodStart="1-Jan-2019 12:00:00 AM"
                            PeriodEnd="31-Dec-2019 11:59:59 PM"
                            VisiblePeriodStart="14-March-2019 12:00:00 AM"
                            VisiblePeriodEnd="11-Nov-2019 11:59:59 PM">
			<telerik:RadTimeBar.Intervals>
				<telerik:YearInterval />
				<telerik:MonthInterval />
				<telerik:WeekInterval />
				<telerik:DayInterval />
			</telerik:RadTimeBar.Intervals>
		</telerik:RadTimeBar>


1 Answer, 1 is accepted

Sort by
0
Accepted
Stenly
Telerik team
answered on 20 Aug 2021, 12:03 PM

Hello Liam,

RadTimeBar control supports non-Gregorian calendars. That said, I have tested the control with every region possible, but I could not reproduce the exception message.

I have attached a sample project, so, could you modify it to match the behavior from your side?

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Liam
Top achievements
Rank 1
commented on 20 Aug 2021, 09:00 PM | edited

Hmm. You might be right. Although I think I am closer to identifying the issue. When I was testing this, I tested it in my actual project by creating a simple RadTimeBar. However, it didn't occur to me that all the styling we have associated with RadTimeBar would have also been applied to my simple RadTimeBar experiment.

What I have now realized is that it seems that I can reproduce the problem with the TimeBar.SelectionThumb control (which is what my project's styling had included when I use RadTimeBar). With an empty project, I can reproduce an issue with this:


	public partial class MainWindow : Window
	{
		public MainWindow()
		{
			CultureInfo culture = CultureInfo.CreateSpecificCulture("ar-EG");
			culture.DateTimeFormat.Calendar = new UmAlQuraCalendar();
			CultureInfo.CurrentCulture = culture;
			InitializeComponent();
		}
	}


<Window x:Class="TelerikWpfApp2.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        	    xmlns:timeBars="clr-namespace:Telerik.Windows.Controls.TimeBar;assembly=Telerik.Windows.Controls.DataVisualization"
                Title="MainWindow" Height="350" Width="525">
        <Grid>
        <timeBars:SelectionThumb
            PeriodStart="1-Jan-2019 12:00:00 AM"
            PeriodEnd="31-Dec-2019 11:59:59 PM">
        </timeBars:SelectionThumb>

    </Grid>
</Window>
There might also potentially be a difference in DLLs that are being used, as I believe the actual project we are working in is using a 2019.1.116.40 version
Liam
Top achievements
Rank 1
commented on 23 Aug 2021, 08:52 PM

Yeah it is looking like an upgrade in my project's Telerik version will be in order. Thanks for helping me look into this.
Stenly
Telerik team
commented on 25 Aug 2021, 11:15 AM

Hello Liam,

After testing with the specified assemblies, the exception was present on my side as well. This behavior was reported as a bug and fixed in the 2019 R3 official release. There is also a possible workaround, which I implemented in an example project for you to test. To fix this behavior, create a new class that extends the SelectionThumb class and set the TitleFormatString property to " " string. 

public class CustomSelectionThumb : SelectionThumb
{
    public CustomSelectionThumb()
    {
        this.TitleFormatString = " ";
    }
}

And you can use it in XAML as follows:

<local:CustomThumb
        PeriodStart="1-Jan-2019 12:00:00 AM"
        PeriodEnd="31-Dec-2019 11:59:59 PM">
</local:CustomThumb>

There might be some design time issues, so clean and rebuild the project and then run it, and the issues will be gone.

Also, I have attached the aforementioned project, so could you try it out?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Liam
Top achievements
Rank 1
commented on 25 Aug 2021, 10:33 PM

This suggestion fixes the issue and provides us with a stopgap until we get Telerik updated. Thank you.
Tags
TimeBar
Asked by
Liam
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or