cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dhinesh28R
Post Prodigy
Post Prodigy

Component based Visibility

Hi,

In  my app i have a component. The following is my screen,

 

P1.png

 

Now what i want is if i click Add form only need to Visible as well as click Edit Gallery only visible. Add and Edit are component.

 

Is it possible in component?

 

Thanks,

Dhinesh 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Dhinesh28R 

You cannot set properties of a control outside of your component.

Your component needs to implement an output property that will determine which option is selected.

From that property of your component you can set the visibility of other controls in your app screen.

 

For example, if you have (in your component) a Gallery (Gallery1 let's say) with an items property of : ["Add", "Edit"] and in that gallery you have a label or button with the Text property set to ThisItem.Value

Then, you can create an Output property on your component called Selected of type text.  Then set its property value (again, in the component) to Gallery1.Selected.Value

 

Now, IN your app screen with the component, you can set the Visible property of your Gallery to

!(yourComponent.Selected = "Add")

Then the Gallery will not be visible when you click add in the component. 

And then set the Form Visible property to : yourComponent.Selected = "Edit"

Then the form will be visible when Edit is selected.

 

The above logic is based on your statement:

If i click Add in a component Gallery will be hide,

If i click Edit in a component Forms alone visible.

 

Please see the attached sample - Download the attached file.  In PowerApps studio, open and existing app or create a new one (doesn't make a difference which), then one you're at the design screen, choose File -> Open -> Browse Then browse for the file you downloaded.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

15 REPLIES 15
RandyHayes
Super User III
Super User III

@Dhinesh28R 

The Component itself cannot change its visibility, but you can change the visible property of the Component based on any condition you want.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes,

Shall i change visible property of a Forms and gallery based on a Component?

 

Thanks,

Dhinesh

RandyHayes
Super User III
Super User III

@Dhinesh28R 

I was not able to determine from your picture which part was the component of your app.  Based on your last response, I assume the add and edit boxes at the top left of the picture is the control.

 

If that is the case, then you can set the visibility of the galleries and forms based on an output property of your component that would specify which item is selected.  Do you have such an output property?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I just set a visibilty for forms and gallery based on my component.

If i click Add in a component Gallery will be hide,

If i click Edit in a component Forms alone visible.

 

Is it Possible? I cant set visibility based on a component.

 

Thanks,

Dhinesh

RandyHayes
Super User III
Super User III

@Dhinesh28R 

You cannot set properties of a control outside of your component.

Your component needs to implement an output property that will determine which option is selected.

From that property of your component you can set the visibility of other controls in your app screen.

 

For example, if you have (in your component) a Gallery (Gallery1 let's say) with an items property of : ["Add", "Edit"] and in that gallery you have a label or button with the Text property set to ThisItem.Value

Then, you can create an Output property on your component called Selected of type text.  Then set its property value (again, in the component) to Gallery1.Selected.Value

 

Now, IN your app screen with the component, you can set the Visible property of your Gallery to

!(yourComponent.Selected = "Add")

Then the Gallery will not be visible when you click add in the component. 

And then set the Form Visible property to : yourComponent.Selected = "Edit"

Then the form will be visible when Edit is selected.

 

The above logic is based on your statement:

If i click Add in a component Gallery will be hide,

If i click Edit in a component Forms alone visible.

 

Please see the attached sample - Download the attached file.  In PowerApps studio, open and existing app or create a new one (doesn't make a difference which), then one you're at the design screen, choose File -> Open -> Browse Then browse for the file you downloaded.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Hi @RandyHayes ,

How to give a value in Components Items property?


For mine there is no Items property in component.P1.png

 

Thanks,

Dhinesh

RandyHayes
Super User III
Super User III

@Dhinesh28R 

So then you would need to create one and provide a table and record schema for the items that will be in it.

 

Please review the sample app that I sent.  It utilizes an Items property and the components Items are set in the app screen as well.  If you look at the Items property in the component, you will see the table and record schema and how it is set.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes ,

Yes man, Now Created a input property with table man. It's came man.

 

Thanks,

Dhinesh

RandyHayes
Super User III
Super User III

 

@Dhinesh28R 

I am not entirely sure what you are saying.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,926)