locked
what is the equivalent of layout_above of android in windows C# or XAML RRS feed

  • Question

  • Hi every one i m new in windows development please help me to find the equivalent of layout_above of android in windows C# or XAML  
    Wednesday, January 8, 2014 12:26 PM

Answers

  • Layout_above is used to place a control over a another control by using ID. In XAML there is no such functionality instead you can add the items in an order one below the other using StackPanel.

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <RelativeLayout 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" >
    <Button 
        android:id="@+id/buttonOnBottom"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="Button on Bottom"
        />
    <Button
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_above="@id/buttonOnBottom"
        android:text="Button Above Button on Bottom"
        />
    </RelativeLayout>
    </LinearLayout>

    The following code in Android gives a output like this

    In XAML this can be like this

     <StackPanel Orientation="Vertical">
                <Button Content="Button Above Button on Bottom"/>
                <Button Content="Button on Bottom"/>
     </StackPanel>


    srithar

    Wednesday, January 8, 2014 12:55 PM