silverlightbuttonsilverlight-4.0silverlight-toolkit

Set ClickMode for all Button-like Controls in Silverlight


I'm looking for an easy way to set ClickMode="Pressed" on every Control in my Silverlight Application (that inherits from ButtonBase obviously).

The solution should also access any ButtonBase-Control that is part of a controltemplate like ComboBox of SilverlightToolkit.

Do i have to create a custom theme for this? If yes, how do i reuse an existing theme and just override this property?

Thanks in advance.


Solution

  • You actually answered your own question. Yes, you can use an existing style to ensure the ClickMode property is set on every ButtonBase control in your app.

    Here is a style that will get you going. This is an un-named style which will ensure that any control that extends from ButtonBase will inherit this style.

     <Style TargetType="ButtonBase">
            <Setter Property="ClickMode" Value="Pressed"/>
     </Style>