ZIndex and silverlight

丶灬走出姿态 提交于 2019-12-11 07:46:40

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/7076024/zindex-and-silverlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!