Search code examples
wpfmaterial-designtimepicker

Disable WPF Material Design Timepicker Hint Text


I am using a Material Design TimePicker to take some time input. The time picker is working fine. But I have a problem about the style. I want to remove the hint Text from the control which is showing up "select time" by default.

control = new MaterialDesignThemes.Wpf.TimePicker { Name = "timepicker_" + df.dataName, SelectedTime = null, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
this.RegisterName("timepicker_" + df.dataName, control);

I am creating the control from code behind. The output of these 2 lines is enter image description here

I want to remove this hint help text from the time pickermcontrol. from code behind.


Solution

  • Set the HintAssist.Hint attached property to string.Empty or null:

    control = new MaterialDesignThemes.Wpf.TimePicker { Name = "timepicker_" + df.dataName, SelectedTime = null, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
    
    MaterialDesignThemes.Wpf.HintAssist.SetHint(control, string.Empty);