The component does not have a resource identified by the uri

后端 未结 20 976
悲哀的现实
悲哀的现实 2020-12-01 07:33

I want to create a Generic DataGrid to use on all my Views/UserControls.

This is my structure:

Class Library called \"Core\":

20条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 07:46

    This can happen also when closing and reopening a window. So it could also have nothing to do with packages and/or dlls.
    I solved the problem thanks to the solution posted by PainElemental, which is IMHO underrated:

    namespace MyNamespace
    {
      public partial class MyDialog : Window
      {
        public MyDialog(ExcelReference sheetReference)
          {
            this.LoadViewFromUri("/MyApp;component/mynamespace/mydialog.xaml");
          }
      }
    }
    

    LoadViewFromUri is implemented as an extension, as PainElemental wrote. The craziest is that I also wrote in the same project other windows without encountering any problem.
    Thank you PainElemental, you ended my protracted pain!

提交回复
热议问题