禁用WPF材质设计Timepicker提示文本

时间:2018-04-20 07:27:42

标签: wpf material-design timepicker

我正在使用Material Design TimePicker来输入一些时间。时间选择器工作正常。但我对这种风格有疑问。我想从显示的控件中删除提示文本"选择时间"默认情况下。

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

我正在从代码背后创建控件。这两行的输出是 enter image description here

我想从时间pickermcontrol中删除此提示帮助文本。从代码背后。

1 个答案:

答案 0 :(得分:2)

HintAssist.Hint附加属性设置为string.Emptynull

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

MaterialDesignThemes.Wpf.HintAssist.SetHint(control, string.Empty);