Articles in this section
Category / Section

How to localize DateTimeEdit Today Button Text?

1 min read

In DateTimeEdit control, it is possible to localize the Today Button content based on application requirement. It can be achieved by retrieving Today Button by customizing DateTimeEdit control Template.


The following Code sample demonstrates the same.



// set the Button_Today_Classic template
private void DateTimeEdit_Loaded(object sender, RoutedEventArgs e)
          ToggleButton button = DateTimeEdit1.Template.FindName("Button_Today_Classic", DateTimeEdit1) as ToggleButton;
           if(button != null)
                button.Content = "Klick mich";



' set the Button_Today_Classic template ‘ 
Private Sub DateTimeEdit_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
  Dim button As ToggleButton = TryCast(DateTimeEdit1.Template.FindName("Button_Today_Classic", DateTimeEdit1), ToggleButton)
  If button IsNot Nothing Then
 button.Content = "Klick mich"
 End If
End Sub




  Figure 1: Before localization



  Figure 2: After localization



Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment