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

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

5 REPLIES 5

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

 

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!

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!

RubikaRubi
New Member

Hello @seadude

 

At end even I have the same glitch problem ,did you fixed it?

Please share the solution if you found anything.

 

Thank you @yashag2255  for the great idea.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (3,807)