DatePicker DateFormat data binding error

Hello Radzen Team!

I'm binding the DateFormat property to a static class method, returning the correct format according to the user preferred language. The designer shows an error but everything works as expected in runtime:



If you send us a sample project we could try reproducing this. Other than that I can suggest using a page property for the format instead of the service directly.

Thanks for the idea, I will use a page property for now.

I forgot to tell that the DatePicker is inside a template that is inside a Tabs component, and from the outside it also shows the same error:

Does the Language service work anywhere in design time?

Pretty much everywhere. It contains the string tables and some other language oriented content.

In this form there are a dozen references to the Language service. Here's an example:

Also in the same template inside the DataList right on the side of the DatePickers:

I think it's something specific to this method, because I tried other method from the LanguageService in the DatePicker and it worked. I'll post both codes for further testing:

        public string GetDateFormat() {
            return DateFormats.FirstOrDefault(x => x.id == Language)?.value ?? "dd/MM/yyyy";
        }
        public string GetText(EN_Text text, bool toLower = false) {
            string result = Texts.FirstOrDefault(x => x.id == (int)text && x.language == Language)?.value ?? "{}";
            return toLower ? result.ToLower() : result;
        }

OK, so the same method with a parameter works:

        public string GetDateFormat(EN_Text test) {
            return DateFormats.FirstOrDefault(x => x.id == Language)?.value ?? "dd/MM/yyyy";
        }

Radzen recognizes the method in the class:
image

This is not specific to the DatePicker component. This parameterless method makes any component
throws an error in the designer no matter where I put it.

I will investigate if it is possible to handle such cases.

I see attempts to fix this issue were addressed in 2.56.4. Indeed my original problem is fixed, but many others (basically all from the Language methods that have a parameter) were created:


It seems to be this issue: Designer looks weird after update to 2.56.4

We have fixed it but the fix isn't released yet. You can use the 2.56.3 until we release it.

1 Like

@kim you can get the latest build for Windows from here.

@enchev @korchev flawless support as always! Thank you very much.