How to display controls (like radwindow) at design time when noxaml is used and implicit style resources are in a custom dll

8 posts, 1 answers
  1. Peter
    Peter avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 Aug 2015 Link to this post

    I want to use Telerik implicit styles because this seems to be the favorite technique to use with Telerik controls. 

    So I use the Telerik noxaml dll's in my project.

    I have made a separate class library in which I have included the Telerik resources (the theme resource files). These resources are merged at startup (in the Application class) using code like

     

    Current.Resources.MergedDictionaries.Clear();
    Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
    {
        Source = new Uri("/libraryDll;component/Themes/System.Windows.xaml", UriKind.Relative)
    });

     

    When running the application all works fine and the radwindow is displayed and styled correctly.

    However, at design time I don't see anything. This is (of course) because at design time the xaml resources are not available (loaded).

     

    How do I fix this problem so I can see the telerik controls at design time? If you can't see the controls you can't design a window can you?

     

    Regards,
    Peter

     

  2. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 12 Aug 2015 Link to this post

    Hi Peter,

    You could merge the same resource dictionaries in Application.Resources of App.xaml file in order to see the controls in the designer. Afterwards you can change the theme in code behind without a problem whenever needed:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/libraryDll;component/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="/libraryDll;component/Themes/Telerik.Windows.Controls.xaml"/>
                <ResourceDictionary Source="/libraryDll;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                <ResourceDictionary Source="/libraryDll;component/Themes/Telerik.Windows.Controls.Navigation.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>

    However if this is not helping, I would like to ask you to share some more details regarding the setup of the project. If you an open up support ticket with a sample project attached, we will be glad to check it on our side and provide you with a solution.

    I'm looking forward to hearing from you.

    Regards,
    Kalin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Peter
    Peter avatar
    6 posts
    Member since:
    Mar 2015

    Posted 12 Aug 2015 Link to this post

    Hi Kalin,

    This can work when I have an App available. But when developing a separate library (assembly/dll) in which I want to create user controls which use telerik controls, I don't have an App.xaml available (because it's a class library and not a wpf app).

    This means I am forced to always include a wpf project when I want to develop a class library that contains telerik controls and uses implicit styles? That's not very convenient.

    Regards,
    Peter

     

  5. Answer
    Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 13 Aug 2015 Link to this post

    Hi Peter,

    I'm sorry for misunderstanding. What I can suggest you would be to check the attached sample project that demonstrates how can use no xaml binaries in separate ControlLibrary project that don't have App.xaml and still have designer working. Basically the project uses approach similar to this one for embedding the Telerik assemblies in the control library. It includes adding the assemblies as embedded resources, a static TelerikThemeUtilities class and some AssemblyResolve work. This pretty much takes care of embedding the assemblies. When extracting the project just add the referenced binaries to the lib folder of the ControlLibrary project and let me know if

    Hope this will work for you.

    Regards,
    Kalin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Peter
    Peter avatar
    6 posts
    Member since:
    Mar 2015

    Posted 13 Aug 2015 in reply to Kalin Link to this post

    Hi Kalin,

    Thanks for the sample. It looks promising and I think it will do the trick. Adding one line (local:TelerikThemeUtilities.DesignTime="True") to each control seems doable.

    I will investigate this further and let you know.

    Regards,

    Peter

  7. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 14 Aug 2015 Link to this post

    Hello Peter,

    Please check it and let us know if you have any further questions or concerns.

    Regards,
    Kalin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Peter
    Peter avatar
    6 posts
    Member since:
    Mar 2015

    Posted 18 Aug 2015 Link to this post

    Hi Kalin,

    Your suggested solution seems to work very well. Thanks :)

    Regards,
    Peter

  9. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 18 Aug 2015 Link to this post

    Hi Peter,

    I'm glad the suggestion helped. If you have any other questions, let us know.

    Regards,
    Kalin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready