sorting elements in a stackpanel WPF

后端 未结 4 1012
春和景丽
春和景丽 2020-12-19 06:35

I have a stackpanel with some usercontrols that are added or removed during runtime. These elements have an index that i assign to them when i new them, I need to keep these

4条回答
  •  北海茫月
    2020-12-19 06:52

    If you want to do that you need to make sure that the Parent is null and also that your index into your panel is not in use.

    If you just swap it into a temp variable, it's still the same reference.

    Use the Visual Tree Helper in order to disconnter or move your UIElement.

提交回复
热议问题