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
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (26,417)