mHelpMe
mHelpMe

Reputation: 6668

WPF Ellipse why can I not add a grid?

I have a WPF application. I am trying to create a ellipse toggle button. I wanted to have a textbox in the ellipse with two images next to each other below the textbox. In my other buttons I have added a grid with two rows to achieve this.

However it doesn't like it when I try to add a grid to an ellipse. "The type ellipse does not support direct content". What does this mean? Is it possible to do what I wish?

Upvotes: 0

Views: 710

Answers (1)

Sheridan
Sheridan

Reputation: 69959

This particular error really couldn't be too much clearer:

The type Ellipse does not support direct content.

The Ellipse Shape is not a ContentControl. Therefore, it does not have a Content property. This means that you cannot add any content to it.

What you can do is to add a Grid with no columns or rows defined and add your Ellipse into the Grid. Then you can overlay other UI elements in front of the Ellipse, which may appear as if they were inside it.

Upvotes: 3

Related Questions