cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FluffyLina
Regular Visitor

How do I make the image increase when I click on it?

Hello!
I created the screen as a tutorial. But all the images were too small. I would like the image to increase when you click on it. How can I do this? All images are uploaded using links from the Internet. I will be happy if you help

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @FluffyLina ,

Do you want to change image's size by clicking the image?

Actually, the image's size is decided by its height and width properties.

So you could set a variable by clicking the image and set the image's height, width based on this variable.

I've made a similar test for your reference:
1)set the screen's OnVisible:

Set(var,true)

2)set image's OnSelect:

Set(var,!var)

3)set image's height:

If(var,200,1000)

set image's width:

 

If(var,200,1000)

 

Set the image's image position to Fit.

 

Then at the beginning the image's size is 200*200, if you click the image, the image's size will become 1000*1000, if you click the image again, it will turn back to 200*200.

5124.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @FluffyLina ,

The reason why the image only stretch  to the right, but not to the left, is that you do not change the image's X and Y property.

Please notice these two properties' defination:

X – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).

Y – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

If you want to the image stretch to two sides, you not also need to change the image's height, width value, but also need to change the image's X and Y.

For example:

X:   If(var,350,350-Image3.Width/2)

Y:  If(var,190,190-Image3.Height/2)

 

To sum up ,you need to set the image's X and Y based on the layout that you want.

Here's a doc about how to set app's layout for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-responsive-layout

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

Hi @FluffyLina ,

Do you want to change image's size by clicking the image?

Actually, the image's size is decided by its height and width properties.

So you could set a variable by clicking the image and set the image's height, width based on this variable.

I've made a similar test for your reference:
1)set the screen's OnVisible:

Set(var,true)

2)set image's OnSelect:

Set(var,!var)

3)set image's height:

If(var,200,1000)

set image's width:

 

If(var,200,1000)

 

Set the image's image position to Fit.

 

Then at the beginning the image's size is 200*200, if you click the image, the image's size will become 1000*1000, if you click the image again, it will turn back to 200*200.

5124.gif

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you, but can I do something that would stretch the image not only to the right, but also to the left?

Hi @FluffyLina ,

The reason why the image only stretch  to the right, but not to the left, is that you do not change the image's X and Y property.

Please notice these two properties' defination:

X – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).

Y – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).

If you want to the image stretch to two sides, you not also need to change the image's height, width value, but also need to change the image's X and Y.

For example:

X:   If(var,350,350-Image3.Width/2)

Y:  If(var,190,190-Image3.Height/2)

 

To sum up ,you need to set the image's X and Y based on the layout that you want.

Here's a doc about how to set app's layout for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-responsive-layout

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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,675)