I have an image which constitutes the subject of a question and I want to place buttons on top of it for the user to click.
I have an object which开发者_运维百科 positions a sprite (a rectangle with a background image which is transformed)
And I have an ItemsControl which positions the buttons using Margin.left and top. Like so
<Grid x:Name="imageGrid">
<local:spriteView Canvas.ZIndex="10" x:Name="QuestionImage" Sprite="{Binding QuestionImageSprite}" />
<local:ImageAnswers Canvas.ZIndex="50" x:Name="AnswersImages" Answers="{Binding answers}"></local:ImageAnswers>
</Grid>
I want AnswersImages
to be positioned directly on top of QuestionImage
but QuestionImage
is pushing AnswerImages
down and AnswerImages
is also affecting the position of QuestionImage
.
How do I stop them from doing that? Can I force them to be positioned absolutely within the ImageGrid
Remove the Canvas.ZIndex
declarations. If your putting them both in a grid without specifying additional Column and Row definitions they will lay ontop of each other in the order they appear in the XAML
精彩评论