开发者

Moving controls from one stackpanel to another

开发者 https://www.devze.com 2023-04-08 05:58 出处:网络
I have a bunch of buttons on a stackpanel which I want to programmatically move back and forth on demand. I\'m struggling to get the visibility/alignment correct. It appears that the buttons seem to h

I have a bunch of buttons on a stackpanel which I want to programmatically move back and forth on demand. I'm struggling to get the visibility/alignment correct. It appears that the buttons seem to have s开发者_C百科ome setting which occurs when they are initially rendered in the first stackpanel as they don't appear next to each other...and yet, if I add(new Button()) instead of add(btn) I see button images stacked together as I expect.

The buttons are very basic 24x24 with an image. No styling/margins etc.

They are moving from a stackpanel with horizontal alignment to one with vertical.

Anyone know what's going on here?


you should be able to do stackpane1.Children.Remove(button) and then stackpanel2.children.add(button)

i suspect you must remove it from one then put into another or you will get funny results

0

精彩评论

暂无评论...
验证码 换一张
取 消