Closed SiggiSch closed 2 months ago
@SiggiSch Assuming you don't have any other Buttons
added to the content of the TimePicker
(where this behavior is not desirable), you should be able to add the resource below which simply amends the button style with a trigger that hides a button when TimePicker.IsEnabled=False
.
<materialDesign:TimePicker materialDesign:HintAssist.HelperText="Helper text"
materialDesign:HintAssist.Hint="Pick Time"
Is24Hours="True"
IsEnabled="False"
Style="{StaticResource MaterialDesignOutlinedTimePicker}">
<materialDesign:TimePicker.Resources>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Visibility" Value="Hidden" />
</Trigger>
</Style.Triggers>
</Style>
</materialDesign:TimePicker.Resources>
</materialDesign:TimePicker>
Thanks @nicolaihenriksen and @Keboo !
It would be nice to hide the Clock-Button of the TimePicker control whenever I want to. For example I would like to hide the button, when the TimePicker is disabled. I could define a binding for that or just hide the button indefinitely.
Maybe with a dependency Property "bool HidePopupButton" or "Visibility HidePopupButton". So that I could use it like this:
We have similar controls in our project, where the button is hidden, when the control is disabled. With the TimePicker we want to have the same behaviour.