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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

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