stmax
stmax

Reputation: 6605

Why can't the XAML designer open controls derived from "Control"?

I'd like to create a custom WPF control. The Control class seems to be the most appropriate class to derive my control from, since I don't need "ContentControl.Content", but I'd like to use Control.Template to make it "lookless".

When I derive my control from Control and try to open it in the designer, the designer shows the message:

"Intentionally left blank. The document root element is not supported by the visual designer."

Googling I found the following: http://msdn.microsoft.com/en-us/library/bb907310(v=vs.100).aspx

Which says: "The WPF Designer supports only Panel, Page, ContentControl and their derivatives as the root element."

As far as I can tell ContentControls basically only extend Controls with a "Content" property. IMHO that's not special enough for the designer to depend on it for being able to open a control.

Could anyone please explain the technical reason for why the designer cannot open controls derived from Control, while it can display ContentControls?

Wouldn't it make sense to be able to open controls derived from "Control" in the designer as well?

Upvotes: 2

Views: 1222

Answers (1)

NestorArturo
NestorArturo

Reputation: 2516

The reason for me is because the MS guys decided so, in other words, an internal decision. Blend can do what you want.

Upvotes: 1

Related Questions