Skip to main content
Microsoft logo
Power Apps
    • AI Builder
    • Automate processes
    • Azure + Power Apps
    • Build apps
    • Connect data
    • Portals
  • Pricing
    • Overview
    • Become a Partner
    • Find a Partner
    • Find partner offers
    • Partner GTM Resources
    • Blog
    • Customer stories
    • Developer Plan
    • Documentation
    • For IT Leaders
    • Roadmap
    • Self-paced learning
    • Webinars
    • App development topics
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • User groups
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Power Apps Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power Apps
    • Building Power Apps
    • Microsoft Dataverse
    • AI Builder
    • Power Apps Governance and Administering
    • Power Apps Pro Dev & ISV
    • Power Apps Portals
    • Connector Development
    • Power Query
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Community Blog
    • Power Apps Community Blog
    • Galleries
    • Community Connections & How-To Videos
    • Community App Samples
    • Webinars and Video Gallery
    • Canvas Apps Components Samples
    • Kid Zone
    • Business Value Webinars and Video Gallery
    • Emergency Response Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Ideas
    • Power Apps Ideas
    • Community Engagement
    • Demo Extravaganza 2021
    • Demo Extravaganza - Components 2021
    • Power Apps Community Demo Extravaganza 2020
    • Experimental
    • Error Handling
    • Power Apps Experimental Features
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Power Apps Community
    • Galleries
    • Canvas Apps Components Samples
    • Re: Shadow Box

    Re: Shadow Box

    05-01-2022 16:23 PM - last edited 05-01-2022 16:25 PM

    eddiel
    Frequent Visitor
    225 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    R3dKap
    Super User R3dKap
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    Shadow Box

    ‎12-30-2019 06:02 AM

    16-may-2022 update: added an application made by @eddiel to generate the code for a shadow (check out explanations below)


    Hello all,

    Here is version 2.0 for one of my first Power Apps components which will allow you to add nice good-looking shadow effects in your applications:

    ShadowBoxSamples.png

    TextBoxDropShadow.gif

    This component, called the ShadowBox, allows you to render a rectangle shadow. The shadow is fully customizable and the corners of the inner box can be rounded (to the point that it renders a full-circle shadow).

    For this new version of the component, properties have been regrouped:

    • Shadow (record) can be used to set the shadow's options: OffsetX, OffsetY, Color, Blur, Opacity
    • Box (record) can be used to set the inner box's options: Fill, Opacity, BorderThickness, BorderColor, Radius
    • Edge (record) can be used to set the edge's option: Position, Width, Color, Padding
    • ShowEdge (boolean) will show/hide the edge

    All details about the component and its properties, along with important notes, can be found here: https://github.com/e-gallis/PowerApps/tree/master/Components/ShadowBox

    To download the component: https://github.com/e-gallis/PowerApps/blob/master/Components/ShadowBox/ShadowBox.msapp

    I hope you'll like this component and that it will help you create nice applications...

     

    EDIT - 16-may-2022 - @eddiel has made a little application with a nice UI to allow you to generate the code for a shadow and just copy/paste it to your image control:

    R3dKap_0-1652728479652.png

    The application is attached to this post and can be downloaded below. Thanks for this @eddiel... 😉

     

    See you all,

    Emmanuel

    Shadow Box Generator 2022 v1_1.msapp
    Labels:
    • Labels:
    • Components
    Message 1 of 31
    17,077 Views
    22 Kudos
    Reply
    • All posts
    • Previous Topic
    • Next Topic
    • « Previous
      • 1
      • 2
      • 3
      • 4
    • Next »
    90_percent
    90_percent Helper I
    Helper I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-05-2022 08:54 AM

    @R3dKap once again, you have made a great component, and the community is grateful. I am sure you are excited to see how many ways and places this component has been used.

    I am trying to use it to help visualize whether a market index was up or down for the day. 
    i have been trying to do this two different ways, and can't get either one to work.

    First way is to set a variable on visible.


    Set(varIndexColor,{
    IWM: If(Value(LookUp(TD_Index_Data, Symbol = "IWN").'Net Chng')>0, {Color: "#00A2E8"}, {Color: "#D16C3D"})


    then in the edge property I used this:
    {Position: Self.EdgePositionEnum.Left, Width: 8, Color: varIndexColor.IWM.Color, Padding: 0}

     

    then i tried this:

    {Position: Self.EdgePositionEnum.Left, Width: 8, Color: (If(Value(LookUp(TD_Index_Data, Symbol = "IWN").'Net Chng')>0, "#00A2E8", "#D16C3D")), Padding: 0}

     

    Both showed this. 

    90_percent_0-1641400340339.png

     

    What am I doing wrong......If I set it manually it showes correctly:

    90_percent_1-1641400395010.png

     

    Message 21 of 31
    442 Views
    0 Kudos
    Reply
    R3dKap
    Super User R3dKap
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-05-2022 01:01 PM

    Hi @90_percent,

    This is due to the fact that, as you may have noticed, I chose to regroup some of the settings within records:

    • one parameter named Shadow for all the shadow settings (with OffsetX, OffsetY, Color, Blur and Opacity sub-properties)
    • same for the Box and the Edge parameters with their own sub-properties

    This means that when you look at those parameters on the Advanced tab on right-hand side of the Studio, you will see something like this:

    R3dKap_0-1641414829513.png

     

    As you can see, this allows you to map the correct sub-properties of the record-type parameters of your component instance on your screen with the sub-properties of the record-type parameters WITHIN the component definition.

    So normally, for instance for the Edge parameter you should have: Color: Color, Padding: Padding, Position: Position and Width: Width just like this...

    R3dKap_1-1641415026751.png

     

    Unfortunately, when you edit the parameters record value, if at any time the Studio detects an error on your formula, then all the mapping of its sub-properties are mixed up and you end up with something like this:

    R3dKap_2-1641415165343.png

    And this leads to an incorrect rendering of your shadow of course...

    This bug has been reported to the MS Power Apps team but doesn't have a fix at the moment yet.

     

    The solution

    So the idea is that every time you change one of the record-type component's parameter value (Box, Shadow or Edge), make sure that right after you check that the mapping of its sub-properties are "aligned" (same name on the left and within the combo box) on the Advanced tab. The three record-type parameters should always look like this at all times:

    R3dKap_3-1641415631078.png

    So, just remapping your component's Edge sub-properties correctly will fix your issue... 🙂

     

    Note: to enlarge the name of the properties within the record-type parameters on the Advanced tab...

    ...from this:

    R3dKap_4-1641415767466.png

    ...to this:

    R3dKap_5-1641415809884.png

    ...which is much easier to read, you should change the width of the associated CSS property by right-clicking on one of the sub-property name and opening the browser page Inspector:

    R3dKap_6-1641415966114.png

     

    And then change the associated CSS...

    ...from this:

    R3dKap_7-1641416068804.png

     

    ...to this:

    R3dKap_8-1641416101179.png

    Just replace "auto" with "100px"...

     

    Hope this helps... 😉

    Message 22 of 31
    430 Views
    0 Kudos
    Reply
    90_percent
    90_percent Helper I
    Helper I
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎01-05-2022 03:31 PM

    90_percent_0-1641425412568.png

    You the man!!!!! thank you.... didn't even catch that it misaligned them on the side!

    Message 23 of 31
    427 Views
    2 Kudos
    Reply
    alekarp
    alekarp
    New Member
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎03-03-2022 03:51 PM

    I was looking for something like this, thank you very much! It serves me too much for the applications I do.

    Greetings!

    Message 24 of 31
    338 Views
    0 Kudos
    Reply
    R3dKap
    Super User R3dKap
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎03-13-2022 04:17 AM

    @alekarp glad you like it and use it! 😊

    Message 25 of 31
    306 Views
    0 Kudos
    Reply
    eddiel
    eddiel
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎05-01-2022 04:23 PM

    @R3dKap thanks for this component. Its awesome.

     

    However, whilst playing around for a project, I reminded myself of the limitation of not being able to use Components yet in Galleries and Forms.

     

    To solve this, I used the experimental component function functionality to create the below functions in a modified version of your component (attached):

    • ShadowBoxGenerator.GenerateImage( Width, Height, Shadow, Box, Edge, ShowEdge )
    • ShadowBoxGenerator.GenerateImageFormula( Width, Height, Shadow, Box, Edge, ShowEdge )

    Both of the above use the same formula parameters as you've used for input parameters as the original component - so is quite easy to use and understand. Only the first two parameters (width and height) are required - otherwise they default to the component's input parameter defaults.

     

    In terms of what they do:

    1. GenerateImage - This can be called to generate an "Image" without creating new instances of the component each time you want to have a shadow box.
    2. GenerateImageFormula - this generates the formula code for the SVG, which can be output to a label control. From here you can copy and paste the code into an Image control. This is useful if you don't want to be dependent on the original component.

    To use:

    1. Create an instance of the component e.g. ShadowBoxGenerator_1.

    2. Call the relevant functions on the component instance e.g. ShadowBoxGenerator_1:

     

    ShadowBoxGenerator_1.GenerateImageFormula(
        Self.Width, Self.Height,
        {OffsetX: 0, OffsetY: 0, Color: "#000000", Blur: 5, Opacity: 0.5}, // Shadow
        {Fill: "#00000000", Opacity: 1, BorderThickness: 0, BorderColor: "#000000", Radius: 0}, // Box
        {Position: ShadowBoxGenerator_1.EdgePositionEnum.Left, Width: 8, Color: "#00A2E8", Padding: 0}, // Edge
        true
    )
    ShadowBoxGenerator_1.GenerateImage( Self.Width, Self.Height )

     

     

    The approach has worked well with Galleries and Forms.

     

    Although it relies on the component functions which are still in experimental release, the code generator in particular doesn't carry any ongoing dependency on the approach, once the image code has been generated and copied. So I still thought it was a valuable.

     

    I've attached a copy of the modified component and would love to get your feedback. 

     

    Thanks

     

    Ed

    1217 KB
    ShadowboxGenerator.msapp
    Message 26 of 31
    225 Views
    2 Kudos
    Reply
    R3dKap
    Super User R3dKap
    Super User
    In response to eddiel
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎05-02-2022 06:22 AM

    Hi @eddiel,

    It's funny because I was just working on adding a new feature in my original ShadowBox component to provide a way to generate that same code to put it in an image control inside a component or inside a gallery... 😁

    You can actually add a component to a gallery if it's inside a container (not directly in the gallery template). But I faced some rendering issues when there are too much items displayed in the gallery. So I had to use an image control instead, with the shadow code inside it.

    The idea of generating the shadow code using a function is very interesting. But I would complete it with a component that allows you "graphically" to set your shadow's settings and then click a GENERATE button. I'll probably include that in my next ShadowBox version... 😉

    Thanks a lot for sharing though... 👍

    Message 27 of 31
    215 Views
    0 Kudos
    Reply
    eddiel
    eddiel
    Frequent Visitor
    In response to R3dKap
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎05-07-2022 03:56 PM

    @R3dKap Thanks for the inspiration. 🙂

    I ended up creating the graphical interface you suggested above, but with the choice whether or not to use components. The two approaches implemented were:

    Approach 1 -  A Shadow Box Code Generator (for an image control) - A simple Canvas App which provides a user interface to play around with the input values for your approach - with no component required... it then generates the code to be copied and pasted into any image control. The size of the shadow box dynamically resizes based on the image control size.

    Approach 2. An updated version of original component, with 2 additional properties:

       i/ "Image" - which directly creates the value for an Image control's image. This still depends on an instance of the component being in the app.

       ii/ "ImageFormulaCode" which generates code that can be copied and pasted into a image without relying on an instance of the component being in the app.

     

    For most scenarios I can think of, I think Approach 1 above works best, because there's no reliance on the developer to understand the inputs in detail or how to use the component or its inputs. They just play around shadow settings using the interface, then copy the code. 

     

    For Approach 2, this would be better perhaps if the values needed to be more dynamically updated (other than height and width, which are already dynamic in Approach 1). However, I had difficulty using a graphical interface to update the component and was not able to get the values to reliably update - which I think is due to a MS bug with components I've seen elsewhere.

     

    Let me know what you think... 🙂

     

    eddiel_0-1651963466846.png

    eddiel_1-1651963888980.png

     

     

    Shadow Box Generator 2022 v1.msapp
    Message 28 of 31
    158 Views
    0 Kudos
    Reply
    R3dKap
    Super User R3dKap
    Super User
    In response to eddiel
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎05-12-2022 04:07 AM

    That's great @eddiel... Nice job! 😀

    If you're ok with it, I can edit my post for the component and add your app to the post, giving you credit for it of course. FYI, I took the liberty of editing your app and just replaced your label that provides the code with a text input that resizes to the same size as the label's: I find it much easier to just click inside the text box, press CTRL-A and then copy/paste the code to the image rather than aiming at the label's starting and ending characters... 😉

    Is that ok with you? What do you think?

    Message 29 of 31
    125 Views
    0 Kudos
    Reply
    eddiel
    eddiel
    Frequent Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    ‎05-12-2022 08:28 AM

    @R3dKap1 definitely go ahead. The idea of the text input control vs label sounds great, and noticed some other users struggle with that when I was having them try it out. 🙂

    Message 30 of 31
    117 Views
    0 Kudos
    Reply
    • « Previous
      • 1
      • 2
      • 3
      • 4
    • Next »

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Automate
    • Power Virtual Agents

    Power Apps

    • Sign in
    • Sign up

    Browse

    • Sample apps
    • Services

    Downloads

    • Studio
    • iOS
    • Android

    Learn

    • Documentation
    • Support
    • Community
    • Give feedback
    • Blog
    • Partners

    • © 2022 Microsoft
    • Follow Power Apps
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks