Change RadDropDownButton's disabled style

6 posts, 0 answers
  1. Valeriy
    Valeriy avatar
    3 posts
    Member since:
    Oct 2017

    Posted 19 Oct 2017 Link to this post

    Hi!

    I need to change RadDropDownButton's disabled style.

    Code:

    <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadDropDownButton">
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Foreground"  Value="Red" />
                            </Trigger>

    Foreground changes it style.  But it is something like watermark.

    How can I remove it? And increase it's contrast.

    Thanks in advance

  2. Dinko
    Admin
    Dinko avatar
    741 posts

    Posted 24 Oct 2017 Link to this post

    Hi Valeriy,

    Thank you for contacting us.

    A possible approach to achieve this is to extract the ControlTemplate of the button and find the VisualState element with its x:Name set to "Disabled". You can navigate to a Border with x:Name DisabledVisual and change its appearance.

    You can take a look at the Editing Control Templates help article in our documentation which describes how you can extract the default template of the controls.

    Regards,
    Dinko
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Valeriy
    Valeriy avatar
    3 posts
    Member since:
    Oct 2017

    Posted 24 Oct 2017 in reply to Dinko Link to this post

    Yes, it also changes. But which property of the border can change style?

    It is still not so contrast. Lokks like transparent watermark on control.

    ...

    <Border x:Name="DisabledVisual"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"

    ...

     

  4. Dinko
    Admin
    Dinko avatar
    741 posts

    Posted 27 Oct 2017 Link to this post

    Hello Valeriy,

    Another approach is to change the opacity in the VisualState with x:Name="Disabled" which TargetName is Content and DropDownIndicator.
    <VisualState x:Name="Disabled">
        <Storyboard>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DisabledVisual">
                <DiscreteObjectKeyFrame KeyTime="0">
                    <DiscreteObjectKeyFrame.Value>
                        <Visibility>Visible</Visibility>
                    </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DropDownIndicator"/>
        </Storyboard>
    </VisualState>
    In your case, I am not sure which theme are you using. The code is extracted from Office_Black theme. Give this approach a try and let me know if it works for you.

    Regards,
    Dinko
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Valeriy
    Valeriy avatar
    3 posts
    Member since:
    Oct 2017

    Posted 27 Oct 2017 in reply to Dinko Link to this post

    Thank you for your answer

    It doesnt work(

    Have you got any idea?

  6. Dinko
    Admin
    Dinko avatar
    741 posts

    Posted 01 Nov 2017 Link to this post

    Hi Valeriy,

    I am not sure that I have understood what is not working from your last reply. Can you elaborate more on your approach? You can send me pictures of the final behavior which you are trying to achieve. Also, which theme are you referencing in your project?

    Regards,
    Dinko
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top