Articles in this section
Category / Section

How to set the image background for the Diagram page in WPF Diagram(SfDiagram)?

1 min read

The WPF Diagram (SfDiagram) control supports setting an image as the background of the diagram page. Images can be added as the background of the diagram page by using the Diagram.Background and Diagram.PageSettings.PageBackground properties.

Code snippet:

//Approach 1
// Set an image for a diagram background.
Diagram.Background = new ImageBrush(new BitmapImage(new Uri(@"pack://application:,,,/Asset/Museum.png", UriKind.RelativeOrAbsolute)));

// Set a transparent color for the page background. The default value is White.
Diagram.PageSettings = new PageSettings()
{
   PageBackground = Brushes.Transparent,
};

// Approach 2
// Set an image for the page background for each Diagram Page.
Diagram.PageSettings = new PageSettings()
{
  PageBackground = new ImageBrush(new BitmapImage(new Uri(@"pack://application:,,,/Asset/Museum.png", UriKind.RelativeOrAbsolute))),
};

View Sample in GitHub

Conclusion

I hope you enjoyed learning about how to set the image background for the Diagram page in WPF Diagram(SfDiagram).

You can refer to our WPF Diagram feature tour page to know 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