Naming user controls without default constructors in XAML
问题 I have a user control without a parameterless constructor; let's call it WithoutDefaultConstructor . I want to insert a WithoutDefaultConstructor called myControl into the XAML code of another control (which is called MainWindow ). However, I get this compiler error: The type 'WithoutDefaultConstructor' cannot have a Name attribute. Value types and types without a default constructor can be used as items within a ResourceDictionary. How do I fix this without adding a parameterless constructor