RadSideDrawer: Location

Depending on the application scenario, RadSideDrawer can be configured to display at a specific location on the screen. This also changes the way the transition animation is applied. There are four available drawer locations:

Changing the drawer location is done by setting one of the four possible values to the drawerLocation property. The four location options are defined by the SideDrawerLocation enum. Setting the drawerLocation property can be done both programmatically and via XML:

public onTopLocationTap(args) {
    this.setDrawerLocation(drawerModule.SideDrawerLocation.Top);
    this.openDrawer();
}

private setDrawerLocation(location: drawerModule.SideDrawerLocation) {
    var sideDrawer: drawerModule.RadSideDrawer = <drawerModule.RadSideDrawer>(frameModule.topmost().getViewById("sideDrawer"));
    if(sideDrawer.android) {
        if (location == drawerModule.SideDrawerLocation.Top || location == drawerModule.SideDrawerLocation.Bottom) {
            sideDrawer.android.setDrawerCloseThreshold(20);
        } else {
            sideDrawer.android.setDrawerCloseThreshold(280);
        }
    }
    sideDrawer.drawerLocation = location;
}
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Left" drawerContentSize="280">

<nsDrawer:RadSideDrawer.drawerTransition>
  <nsDrawer:RevealTransition/>
</nsDrawer:RadSideDrawer.drawerTransition>

  <nsDrawer:RadSideDrawer.drawerContent>
  </nsDrawer:RadSideDrawer.drawerContent>

  <nsDrawer:RadSideDrawer.mainContent>
    <StackLayout class="mainContent">
      <Label text="{{drawerPositionText}}" textWrap="true" class="drawerContentText"/>

      <ScrollView>
        <StackLayout>
            <Button text="Left" tap="{{ onLeftLocationTap }}" class="drawerContentButton"/>

            <Button text="Top" tap="{{ onTopLocationTap }}" class="drawerContentButton"/>

            <Button text="Right" tap="{{ onRightLocationTap }}" class="drawerContentButton"/>

            <Button text="Bottom" tap="{{ onBottomLocationTap }}" class="drawerContentButton"/>

        </StackLayout>
      </ScrollView>
    </StackLayout>
  </nsDrawer:RadSideDrawer.mainContent>
</nsDrawer:RadSideDrawer>

References

Want to see this scenario in action?
Check our SDK examples repo on GitHub. You will find this and many other practical examples with NativeScript UI.