Button Adv Transparent background in all states

I'm trying to create a ButtonAdv that would have no background in any state (Enabled/Disabled/Mouse on).

This is what my style currently looks like:
<code>
                               <Style BasedOn="{StaticResource SyncfusionButtonAdvStyle}" TargetType="syncfusion:ButtonAdv">
                                        <Setter Property="SizeMode" Value="Large" />
                                        <Setter Property="IconHeight" Value="25" />
                                        <Setter Property="IconWidth" Value="25" />
                                        <Setter Property="VerticalAlignment" Value="Center" />
                                        <Setter Property="Margin" Value="5" />
                                        <Setter Property="IsTabStop" Value="False"></Setter>
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background" Value="Transparent" />
                                            </Trigger>
                                            <Trigger Property="IsEnabled" Value="False">
                                                <Setter Property="Background" Value="Transparent" />
                                                <Setter Property="Foreground" Value="#42FFFFFF" />
                                            </Trigger>
                                            <Trigger Property="IsEnabled" Value="True">
                                                <Setter Property="Background" Value="Transparent" />
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
</code>
Note the SyncFusionButtonAdvStyle Style was added in App.xaml to a resource dictionary:
<code>
  <ResourceDictionary Source="/Syncfusion.Themes.MaterialDark.WPF;Component/buttonadv/buttonadv.xaml" />
</code>
However, only the background setter for the IsEnabled = True state is working:


I get the dimmed grey background when hovering on the enabled button (upper one) as well.

Is there any way I can disable this behaviour? Thank you.

3 Replies 1 reply marked as answer

EM Elakkiya Muthukumarasamy Syncfusion Team February 8, 2021 12:52 PM UTC

Hi Omar Ibrahim, 

Greetings from Syncfusion. 

We have checked your reported query “Need to set Button Adv background as Transparent in all states and it has been achieved by editing the control template of the ButtonAdv. Please refer the below code snippet and sample for the same. 

Code example: 
<Trigger Property="IsMouseOver" Value="True"> 
<Setter Property="Background" TargetName="ItemBorder" Value="Transparent"/> 
<Setter Property="BorderBrush" TargetName="ItemBorder" Value="#FF565656"/> 
<Setter Property="Foreground" TargetName="PART_NormalText" Value="#DDFFFFFF"/> 
<Setter Property="Foreground" Value="#DDFFFFFF"/> 
<Setter Property="Effect" TargetName="ItemBorder"> 
<Setter.Value> 
<DropShadowEffect BlurRadius="8" Color="#AA000000" Direction="270" Opacity="0.42" RenderingBias="Performance" ShadowDepth="1.5"/> 
</Setter.Value> 
</Setter> 
</Trigger> 


Please try it with the provided solution and let us know if you need any further assistance on this. We will be glad to assist you. 

Regards, 
Elakkiya 



OI Omar Ibrahim February 12, 2021 12:01 AM UTC

Hello.

Thank you very much. This wasn't quite what I wanted, but I just edited the template to fit my needs. I tried doing the same thing by editing a template, but the template was full of properties set to static resources that I didn't have defined. In the ControlTemplate you provided, properties like foreground and background all had hard-coded values in the ControlTemplate.

I'm trying to do the same thing right now for DropDownButtonAdv, but I don't want to have to define all the static resources that different properties in the copied template reference. Could you kindly provide me with an editable template for DropDownButtonAdv, or tell me how to obtain a template that doesn't reference non-existent static resources?


VR Vijayalakshmi Roopkumar Syncfusion Team February 12, 2021 12:06 PM UTC

Hi Omar  
  
Thank you for contacting Syncfusion Support. 
 
Query : Im trying to do the same thing right now for DropDownButtonAdv, but I don't want to have to define all the static resources that different properties in the copied template reference. Could you kindly provide me with an editable template for DropDownButtonAdv, or tell me how to obtain a template that doesn't reference non-existent static resources? 
 
We have checked the reported query and understood that you want to change the background to Transparent for all states of DropDownButtonAdv as like ButtonAdv. We have prepared the sample for the same, please download it from following location: 
 
 
However you can obtain the template of any syncfusion control of desired theme by using blend support. For more information, refer the following UG: 
 
 
 
Also for certain themes, we would maintain some brushes to keep the appearance varied in each themes. However for all our latest themes such as Material ,office2019, we can use it by referring the Brushes.xaml resource dictionary from respective theme assembly. This xaml file contain contain all  keys used in our latest themes.You can export the theme project from themestudio and you can find Brushes.Xaml file in Common folder.  
Code: 
 
Code shows the merging the brushes.xaml app resource dictionary 
 
 
<Application.Resources> 
<ResourceDictionary> 
<!--Referring the brushes.xaml--> 
<ResourceDictionary.MergedDictionaries> 
<ResourceDictionary Source="/Syncfusion.Themes.MaterialDark.WPF;component/Common/Brushes.xaml" /> 
<ResourceDictionary Source="/Syncfusion.Themes.MaterialDark.WPF;component/DropDownButtonAdv/DropDownButtonAdv.xaml" /> 
</ResourceDictionary.MergedDictionaries> 
</ResourceDictionary> 
</Application.Resources> 
 
 
 
Please try this suggestion and let us know if you have any other concerns. 
 
Regards, 
Vijayalakshmi VR 
 


Marked as answer
Loader.
Up arrow icon