Share via

How to Include Third-Party Control Style in a Merged Dictionary

RogerSchlueter-7899 1,611 Reputation points
2022-12-23T02:32:02.143+00:00

I am getting an error trying to create a style for a third-party control in a Merged Dictionary. Here is my Applicatiojn.xaml:

<Application  
    x:Class="Application"  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">  
    <Application.Resources>  
        <ResourceDictionary>  
            <ResourceDictionary.MergedDictionaries>  
                <ResourceDictionary Source="Models/BaseResources.xaml"/>  
            </ResourceDictionary.MergedDictionaries>  
        </ResourceDictionary>  
    </Application.Resources>  
</Application>  

and here is the relevant part of the Merged Dictionary:

<ResourceDictionary  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">  
    <Style  
        x:Key="DateTimePickerBase"  
        TargetType="{x:Type xctk:DateTimePicker}">  
        <Setters .... >  
 <....>  
</ResourceDictionary>  

I get this error:

Failed to create a 'Type' from the text 'xctk:DateTimePicker'

The Merged Dictionary, BaseResources.xaml, has Build Action = Resource My searches have not yielded any useful results. What am I missing?

Developer technologies | Windows Presentation Foundation
0 comments No comments
{count} votes

Answer accepted by question author
  1. Hui Liu-MSFT 48,711 Reputation points Microsoft External Staff
    2022-12-26T02:48:19.003+00:00

    Hi, @RogerSchlueter-7899 . Welcome to Microsoft Q&A.

    You could set Build Action to Page and now it will work.

    Hope my solution could help you.

    ----------------------------------------------------------------------------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.