What should I do in order to locate a UIElement to a specific postion?


  • how can I use following properties like Margin,Width,Height?

    For example:

    I have parent Panel A whose width is 100 and heigth is 200.And i am intent to locate its child B whose width equals to A and height is 50 to the postion which is closed to bottom border of A. how can I do if i hope to keep the relative postion and size always?

    • Edited by cybupt Tuesday, April 17, 2012 3:20 AM
    Tuesday, April 17, 2012 3:13 AM


  • Hello,

    You can set Orientation="Horizontal" in outside stack panel, and set VerticalAlignment="Bottom" in inside stack panel.

            <StackPanel  Width="100" Height="200" Margin="10,73,0,0"  Background="#FF2CC139" Orientation="Horizontal">
                <StackPanel Width="100" Height="50" Background="red" VerticalAlignment="Bottom"/>

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Jesse Jiang Wednesday, April 25, 2012 7:07 AM
    Wednesday, April 18, 2012 5:26 AM