The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
[UWP][XAML]Cannot Get StaticResource When Setting ItemsSource in XAML at Design Time RRS feed

  • Question

  • I am working on a UWP app, and want to create some design time sample data for the ItemsControl(s) in my XAML. I have managed to do this by creating a class with the sample data, creating a StaticResource in my Page.Resources for the sample data class, and setting the ItemsSource properties of the ItemsControl(s) to that StaticResource. This works fine when the DataTemplate does not use any other StaticResource(s) (such as Style(s) and Converter(s)), but if it does, it says the resource could not be resolved. Everything works fine during runtime, but I would like to be able to have design time data. Any ideas? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Wednesday, April 24, 2019 11:30 PM

All replies

  • Hi,

    I could reproduce your problem. I searched about the document about this. But no document mentioned such limitation about sample data. I'll report this issue to the team. There might be some time delay. Thank you for your patience.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 25, 2019 6:49 AM
  • I am working on making my XAML more design time friendly. Everything works perfect during runtime, but if any of my DataTemplates contain any StaticResources (such as Styles, Converters, other DataTemplates, etc.), they do not work. Therefore, the designer displays a large amount of the elements in the DataTemplate without Styles, Converters, and/or DataTemplates, making the designer very hard to use. Bindings in the DataTemplate do not cause a problem, it is only the StaticResources. All of my scenarios are DataTemplates that are for a control (either a ContentControl or ItemsControl) that is inside another DataTemplate, which means that all of my problem DataTemplates/StaticResources are nested. Why is this a problem during design time even though everything works fine during runtime, and what can I do to make it more design time friendly? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Thursday, April 25, 2019 8:21 PM
  • Hi,

    I had reported your problem yesterday. Now we are waiting for the response from the team. 

    You could also report this in the FeedBack Hub. You can find it in the start Menu.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 26, 2019 3:04 AM