Point and Navigate to Screens in Component.
In my previous post, we have created the UI for the component. If you haven't seen it, please check it first before moving on here.
In this post, we will be learning how the items in our gallery will point to screens on our App once we place this component on those 3 screens.
Steps:
1. Click on the component 'compLeftNavBar' under Tree View and then under `Properties`, click `New custom property'.
2. Type 'MenuItems' and set the data type to `Table` and press Create.
3. Select `MenuItems` property on top and set its value to:
Table(
{
MenuLabel: "Home",
MenuIcon: Icon.Home,
MenuScreenNavigate: App.ActiveScreen,
MenuID: 1
},
{
MenuLabel: "Profile",
MenuIcon: Icon.CheckBadge,
MenuScreenNavigate: App.ActiveScreen,
MenuID: 2
},
{
MenuLabel: "Cart",
MenuIcon: Icon.AddDocument,
MenuScreenNavigate: App.ActiveScreen,
MenuID: 3
}
);
You can edit the `MenuIcon` according to you.
If you can't see it, try refreshing your browser tab after saving your work.
4. Now click on the gallery on your component and edit its `Items` property to `compLeftNavBar.MenuItems` (without quotes).
Steps to Edit the elements inside your gallery:
1. Click on the label and set its `Text` property to `ThisItem.MenuLabel`.
2. Similarly, click on Icon and set its `Icon` property to `ThisItem.MenuIcon`.
Till now, your component will look like this:
Now you would want to click on Home and navigate it to a different screen or click on Profile and navigate to Profile screen. To do this, you'll need to place a transparent button behind your label.
1. Place a button in your gallery for 1 item.
2. Edit the `Height` property of this button to heigh of our label. So, name of label is `lblTitle` then value for the height property will be `lblTitle.Height+lblTitle.Y`.
3. Similarly edit the `Width` property of this button to width of the template which will be, `Parent.TemplateWidth`.
4. Set the X and Y property of this button to 0.
This is how it will look:
Now you need to make your button transparent. For that:
1. Set the `Fill`, `HoverFill`, `PressedFill` properties of the button to `Color.Transparent`.
Now you have a button for all three labels set to transparent:
Now set the `OnSelect` property of this button to `Navigate(ThisItem.MenuScreenNavigate)`.
Comments
Post a Comment