Articles in this section
Category / Section

How to Change the Background Color of a Symbol in WPF SfDiagram?

2 mins read

In the WPF Diagram, you can change the background color of a symbol that is in the disabled state by defining triggers within the style of the symbol. The IsEnabled property is used to check the symbol’s enabled state. Based on this condition, you can apply the necessary changes to the background color. Here is a code example to show how to achieve this:

Code Snippet

<Style TargetType="Stencil:Symbol">
   <!-- Binding the IsEnabled property with a custom property. -->
   <Setter Property="IsEnabled" Value="{Binding IsSymbolEnabled}"/>
   <Setter Property="Width" Value="100" />
   <Setter Property="Height" Value="110" />
   <Setter Property="Padding" Value="1" />
   <Setter Property="BorderThickness" Value="1" />
   <Setter Property="Background" Value="Transparent" />
   <Setter Property="BorderBrush" Value="Transparent" />



   <!-- DataTrigger to change Background and Cursor when IsEnabled is false -- >
   <Style.Triggers>
       <Trigger Property="IsEnabled" Value="False">
           <Setter Property="Background" Value="Gray" />
           </Trigger>
   </Style.Triggers>
</Style> 

ScreenCapture_12-2-202461852PM-ezgifcom-video-to-gif-converter.gif

Conclusion
I hope you enjoyed learning how to change the background color of a symbol in WPF SfDiagram.

You can refer to our WPF Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied