radGridView calander filter localization

1 Answer 24 Views
Calendar, DateTimePicker, TimePicker and Clock FilterView GridView Localization
ebrahim
Top achievements
Rank 1
Iron
Iron
ebrahim asked on 13 Jan 2022, 01:53 PM

hi

How to localization  the calendar in the filter radgridview

image atached

 

thanks

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Jan 2022, 12:19 PM
Hello, Ebrahim,

To localize RadGridView to display control text and messages in a specific language, it requires creating a descendant of the RadGridLocalizationProvider class. Then, override the GetLocalizedString(string id) method and provide a translation for the label and user messages:
https://docs.telerik.com/devtools/winforms/controls/gridview/localization/localization 
        public class MyEnglishRadGridLocalizationProvider : RadGridLocalizationProvider
        {
            public override string GetLocalizedString(string id)
            {
                switch (id)
                {
                    case RadGridStringId.FilterFunctionToday:
                        return "TodayEN";
                    case RadGridStringId.FilterFunctionYesterday:
                        return "YesterdayEN";
                }
                return base.GetLocalizedString(id);
            }
        }
            RadGridLocalizationProvider.CurrentProvider = new MyEnglishRadGridLocalizationProvider();
         
            InitializeComponent();
As to the calendar days/months, it depends on the currently applied culture, e.g. 
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE");


I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
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/.

ebrahim
Top achievements
Rank 1
Iron
Iron
commented on 17 Jan 2022, 08:18 AM

Hello, how can I access its calander(filter) properties

for change properties like zoomlevel

 

this code not work


 private void radGridViewListAllPeriodDetail_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
        {


            RadDateTimeEditor editor;
            RadDateTimeEditorElement element;
            editor = this.radGridViewListAllPeriodDetail.ActiveEditor as RadDateTimeEditor;
            element = editor.EditorElement as RadDateTimeEditorElement;
            RadDateTimePickerCalendar calendarBehavior = element.GetCurrentBehavior() as RadDateTimePickerCalendar;
            RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;
            calendar.HeaderNavigationMode = HeaderNavigationMode.Zoom;


        }

Dess | Tech Support Engineer, Principal
Telerik team
commented on 17 Jan 2022, 10:33 AM

Hello, Ebrahim,

RadGridView offers the CellEditorInitialized event which fires when the editor is already activated and initialized. It is the appropriate place to apply any changes to the editor and adjust any property settings. The GridViewCellEventArgs gives you access to the ActiveEditor and the initial Value.

        private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
        { 
            RadDateTimeEditor editor = e.ActiveEditor as RadDateTimeEditor;
            RadDateTimeEditorElement element = editor.EditorElement as RadDateTimeEditorElement;
            RadDateTimePickerCalendar calendarBehavior = element.GetCurrentBehavior() as RadDateTimePickerCalendar;
            RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;
            calendar.HeaderNavigationMode = HeaderNavigationMode.Zoom;
        }

ebrahim
Top achievements
Rank 1
Iron
Iron
commented on 17 Jan 2022, 11:04 AM


private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { RadDateTimeEditor editor = e.ActiveEditor as RadDateTimeEditor; RadDateTimeEditorElement element = editor.EditorElement as RadDateTimeEditorElement; RadDateTimePickerCalendar calendarBehavior = element.GetCurrentBehavior() as RadDateTimePickerCalendar; RadCalendar calendar = calendarBehavior.Calendar as RadCalendar; calendar.HeaderNavigationMode = HeaderNavigationMode.Zoom; }

 

but this code not work

image atached


Dess | Tech Support Engineer, Principal
Telerik team
commented on 17 Jan 2022, 11:27 AM

Hello, Ebrahim,

Please excuse me for the misunderstanding. The previously provided code snippet is applicable for the editor which is activated when the cell enters edit mode. However, for the Excel-Like filter popup, the FilterPopupInitialized event is the appropriate place: 
        private void RadGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
        {
            RadDateFilterPopup filterPopup = e.FilterPopup as RadDateFilterPopup;
            if (filterPopup != null)
            {
                filterPopup.CalendarItem.CalendarElement.Calendar.HeaderNavigationMode = HeaderNavigationMode.Zoom;
            }
        }

ebrahim
Top achievements
Rank 1
Iron
Iron
commented on 17 Jan 2022, 12:07 PM

thanks for this code
Tags
Calendar, DateTimePicker, TimePicker and Clock FilterView GridView Localization
Asked by
ebrahim
Top achievements
Rank 1
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or