Custom control resource dictionaries RRS feed

  • Question

  • I'd like to place additional resources in the resource dictionary of a C++ WinRT custom control and access them at runtime.

    I've added a resource dictionary called CustomDictionary into the merged dictionaries in generic.xaml as follows:

            <ResourceDictionary Source="ms-appx:///MyControl/CustomDictionary.xaml"/>

    However when I try to look up a resource at runtime, it's not found. If access the custom control's resource dictionary at runtime using "this -> Resources", the Size property of the resulting ResourceDictionary object is 0. If I access the ThemeDictionaries or MergedDictionaries property of the ResourceDictionary, their sizes are also 0. This is true whether CustomDictionary is merged in or not.

    What is the correct way to access a custom control's resources at runtime?

    Friday, January 4, 2013 1:17 PM


  • Hi,

    I think we should make sure if the xaml file is in that folder (solution name\Debug\App name\ MyControl\).

    The solution explorer is Filter not the folder as the default settings. We can check the exist file using Show All files button.

    Best regards,

    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Jesse Jiang Wednesday, January 9, 2013 2:08 AM
    • Marked as answer by Jesse Jiang Thursday, January 10, 2013 2:34 AM
    Monday, January 7, 2013 7:21 AM