cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
seadude
Memorable Member
Memorable Member

COMPONENTS: Set Gallery Default based on screen?

Hello,

I have a menu component that I like to drop into new apps. The menu consists of a Gallery of screen names. When user clicks on a screen name, they navigate to that particular screen. No problems here.

Issue:

  • The Gallery Default property is set to `{}` (blank)
  • I need it set to the current Screen

I can't quite figure out how to access a sreen control name through a Component.
Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @seadude 

 

Can you try to modify few properties as:
Component Custom Property (cmpMenuItems) placeholder code:
Table({screen: App.ActiveScreen, screenName: "Home", icon: Icon.Home })
 
Component Gallery Default property:
LookUp(Component1.CustomProperty1,screen = App.ActiveScreen)
 
Component Gallery Icon OnSelect property:
Navigate(LookUp(Component1.CustomProperty1,screenName = ThisItem.screenName).screen)
 
I carried out a test on my side and using below properties the component was working fine. There was no need for selecting the icon twice.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
yashag2255
Dual Super User II
Dual Super User II

Hi @seadude 

 

I carried out a test on my side and you can use below expression on the "Default" property of your Gallery control:
 
Expression: {Value: App.ActiveScreen.Name}MicrosoftTeams-image (196).png

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 , Thank you very much for the assistance! The menu must be clicked two times to "stick". Can you tell why?

Scenario:

  • Component Custom Property (cmpMenuItems) placeholder code:
    Table({screen:"Test", screenName: "SampleText", icon: SampleImage})
  • Component Gallery Items property:
    componentName.cmpMenuItems
  • Component Gallery Defualt property:
    {screen: App.ActiveScreen.Name} // Requires clicking twice 
  • Component Gallery OnSelect property:
    Navigate(
        LookUp(colMenuItems,
            ThisItem.screenName = screenName, screen
        )
    )
  • App OnStart code:
    ClearCollect(
            colMenuItems,
            {screen: scrHome, screenName: "Home", icon: Icon.Home },
            {screen: scrReports, screenName: "Reports", icon: Icon.Document},
            {screen: scrMaps, screenName: "Maps", icon: Icon.Pin},
            {screen: scrContacts,screenName: "Contacts", icon: Icon.Person}
    )
  • Component (in app) cmpMenuItems property: colMenuItems

Are you able to tell why the menu must be clicked twice to "stick"?

 

componentMenu.gif

 

yashag2255
Dual Super User II
Dual Super User II

Hi @seadude 

 

Can you try to modify few properties as:
Component Custom Property (cmpMenuItems) placeholder code:
Table({screen: App.ActiveScreen, screenName: "Home", icon: Icon.Home })
 
Component Gallery Default property:
LookUp(Component1.CustomProperty1,screen = App.ActiveScreen)
 
Component Gallery Icon OnSelect property:
Navigate(LookUp(Component1.CustomProperty1,screenName = ThisItem.screenName).screen)
 
I carried out a test on my side and using below properties the component was working fine. There was no need for selecting the icon twice.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Hi @yashag2255 ,

 

Thank you VERY much for the assistance. You taught me a few very insightful things! And your solution worked. There is still some strange behaviour (a double-clicking- type thing happening, but its not a showstopper).

menuDoubleClick.gif

 

Thanks again!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,122)