RadDiagram Not Showing After Installing NuGet Packages
Environment
| Product Version | 2019.1.305 |
|---|---|
| Product | RadDiagram for WPF |
Description
RadDiagram does not appear after you install Telerik UI for WPF NuGet packages without embedded styles. This can also affect other controls, such as RadButton.
The following historical packages.config example shows the NoXaml packages for RadDiagram:
<packages>
<package id="Telerik.Windows.Controls.Diagrams.for.Wpf" version="2019.1.305" targetFramework="net45" />
<package id="Telerik.Windows.Controls.for.Wpf" version="2019.1.305" targetFramework="net45" />
<package id="Telerik.Windows.Diagrams.Core.for.Wpf" version="2019.1.305" targetFramework="net45" />
</packages>
The package versions and target framework in these examples describe the historical setup, not requirements for the solution. Use the release and target framework supported by your project. See the available NuGet packages for current package options.
Solution
The packages shown contain NoXaml assemblies, which do not include control styles and templates. Without the required theme resources, the controls cannot display their default appearance.
Choose one of the following solutions. Use Xaml packages for embedded styles, or keep NoXaml packages and configure implicit styles.
Do not mix Xaml and NoXaml control assemblies. Keep all Telerik UI for WPF control and theme packages on the same release version.
Solution #1: Using Xaml Packages
Xaml control packages include styles and templates, so you do not need to merge NoXaml theme dictionaries to display the control.
Replace the NoXaml control packages with their .Xaml equivalents:
- Remove the NoXaml control package references, including those for other Telerik controls in the project.
- Install
Telerik.Windows.Controls.Diagrams.for.Wpf.Xamland use the.Xamlequivalents for any other Telerik control packages. NuGet installs the required dependencies automatically. - Rebuild and run the application.
RadDiagramshould display with its embedded default styles.
Solution #2: Using NoXaml Packages with a Theme
Keep the NoXaml control packages and add a theme using implicit styles:
-
Install
Telerik.Windows.Themes.Fluent.for.Wpfat the same release version as your Telerik UI for WPF control packages. For the historicalpackages.configsetup, the theme package entry is:XML<packages> <!-- other packages here --> <package id="Telerik.Windows.Themes.Fluent.for.Wpf" version="2019.1.305" targetFramework="net45" /> </packages> -
In
App.xaml, place the following XAML fragment insideApplication.Resources. If an explicitResourceDictionaryalready exists, add these entries to itsMergedDictionariescollection instead of replacing existing resources. If resources are declared directly insideApplication.Resources, move them inside the newResourceDictionary, afterResourceDictionary.MergedDictionaries, preserving their keys and relative order. Preserve the theme dictionary order shown:XAML<ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"/> <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"/> <ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.Diagrams.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> -
Rebuild and run the application.
RadDiagramshould display with the Fluent theme.
These dictionaries cover the basic RadDiagram control. If you use additional controls or diagram extensions, merge the dictionaries for their control assemblies too. See the RadDiagram assembly requirements and the implicit-styles theme setup.
If a control still does not appear and you use custom styles, verify that each custom style is based on the corresponding default control style. See styling controls with NoXaml assemblies.