2

I've looked at and tried these other solutions that I've found, and even copied Telerik's Documentation. However, I still can't get a working solution.

XAML:

    <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="NotifyIconResources.xaml" />
            <ResourceDictionary Source="pack://application:,,,/Telerik.Windows.Themes.Windows8;component/Themes/System.Windows.xaml" />
            <ResourceDictionary Source="pack://application:,,,/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.xaml" />
            <ResourceDictionary Source="pack://application:,,,/Telerik.Windows.Themes.Windows8;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />
        </ResourceDictionary.MergedDictionaries>

Here is an image of the error that ReSharper is giving: ReSharper Image

Here's an image of the assembly being a reference: Assembly as reference

Here's an image of the assembly properties: Assembly properties

Lastly, here's the exception information when I try to run the app:

System.Windows.Markup.XamlParseException was unhandled
  HResult=-2146233087
  Message='Cannot create unknown type '{clr-namespace:Telerik.Windows.Controls.External}Windows8ThemeExternal'.' Line number '15' and line position '6'.
  Source=PresentationFramework
  LineNumber=15
  LinePosition=6
  StackTrace:
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at MyApp.App.InitializeComponent() in App.xaml: line 1
       at MyApp.App.Main() in c:\MyApp\obj\Debug\App.g.cs: line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Xaml.XamlObjectWriterException
       HResult=-2146233088
       Message='Cannot create unknown type '{clr-namespace:Telerik.Windows.Controls.External}Windows8ThemeExternal'.' Line number '15' and line position '6'.
       Source=System.Xaml
       LineNumber=15
       LinePosition=6
       StackTrace:
            at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
            at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
            at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
            at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       InnerException: 
Community
  • 1
  • 1
Cameron
  • 2,574
  • 22
  • 37

1 Answers1

1

The first thing that I know IS wrong and that has to be added, according to Telerik documentation,

They can be merged in the resources of your application (in App.xaml) and as a result will be applied implicitly on any control that does not have a local Style set. For example, if you need to style a control from Telerik.Windows.Controls.dll, you need the Telerik.Windows.Controls.xaml resource dictionary.

That being said you're missing a ResourceDictionary for DataVisualization. If that doesn't solve the problem, keep reading.

Last I recall, when I was looking at theme'ing my application using Telerik, there are a couple different ways you can apply styles, and doing it right might be a little tricky at first. There is Implicit Styling (NoXaml) and there is standard styling, where styles are built into the control libraries. Implicit styling is the recommended approach for styling your application in a "global" manner. IIRC, it is also more performant is much more clean in code.

Since we talked in the WPF chat, it sounds like you weren't sure which binaries you were trying to build from source. Implicit styles requires you to build the Binaries.NoXaml source code. After that's said and done, you have to make sure you're adding references to the correct assemblies coming from the ..\Binaries.NoXaml\WPF4x\ directory.

The last time I built from source, the build instructions were included inside the downloaded .ZIP. Make sure you follow those instructions carefully. I have no used built in Visual Studio Telerik tools to build/deploy my referenced libraries, so if you are, then maybe manual is the way to go.

A couple other things. I'm suspicious the build wasn't successfully completed. Your Version # on your Telerik references should be something other than 0.0.0.0. Secondly, if I remember correctly, I had problems with defining the source and possibly the order matters--so try the source that I used in my example below, and maybe move the NotifyIconResources.xaml below the Telerik declarations.

Here is my XAML used with implicit style technique:

<ResourceDictionary Source="/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows7;component/Themes/System.Windows.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Input.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />

As always, starting a new project and getting a basic thing like this working might do you wonders and it will also prevent you from changing so many things in your current code base that you end up forgetting the things you've changed and causing issues in places you don't want them.

Kcvin
  • 5,073
  • 2
  • 32
  • 54