cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dave-jorgensen
Advocate V
Advocate V

DisplayMode=View removes border

Would be greating if having controls with DisplayMode=View can have a border. I see a similair post about the padding being removed when in View mode, but since this is a seperate issue, I'm making a new item.

 

Any way to have a control (textbox or label) have a border, and also be in View Mode?

 

Thanks

34 REPLIES 34

Depending on your scenario you may be forced to using shapes to block input or to use as a border. In my case using disabled display mode is not a good solution as it looks completely different from view mode:

2020-09-18_17h05_47.png

My use case is that lookup numbers can change from the time they're initially input to when they need to be processed so validation has to happen both at the form entry and just before processing so I need to indicate the field needs attention before processing even in view mode. I'll be using a rectangle behind this since it's a gallery and only requires one shape to configure, but can see how it is not ideal for other situations.

Mattw112IG
Impactful Individual
Impactful Individual

There's DisplayMode.Disabled and DisplayModeDisabled

 

The .Disabled grays it out, the Displaymodedisabled doesn't?

 

Not sure the difference, but I can at least get a border without adding extra controls.

 

 

Terry

It seems that the value of DisplayMode is not checked internally by PA.

I have added this code to the DisplayMode property of my data cards.

 

All of my data cards have a DisplayMode set to the Parent (Data form)  

if(Parent.DisplayMode=DisplayMode.View, junk, Parent.DisplayMode)

 

Now the border appears and the field is not editable, which is what I want.  I opted for this because the data card border provide a nice gridwork around my controls, and I don't want to make 30+ rectangles around my cards.  This does have the negative side effect of causing the app checker to flag an error.  This could "hide" a real issue that has an unintended effects.

Thanks @moose , this workaround works pretty well! 

may i know, what is junk in this code ? i try to replace junk with some option like thisitem.attachment but it flagged an error

if(Parent.DisplayMode=DisplayMode.View, junk, Parent.DisplayMode) 

@laurent_rio - I'm not following either. The mention of the DisplayMode property there and the formula has an else of what DisplayMode to use so it only makes ense that junk has to be another display mode like DisplayModedisabled that @Mattw112IG is pointing out since it's a response to that statement?

 

To add to that, out of curiosity I tested out the differences of DisplayMode.Disabled and DisplayModeDisabled. As @Mattw112IG mentions the former grays it out and the latter does not, but actually appears to be like edit mode. Using the DisabledBorderColor property only works if the former (.Disabled) is being used. In this example the top is the former and the bottom is the latter:

 

vwyankee_0-1606314969927.png

 

troyv808
Regular Visitor

I ran into the same problem and found a more elegant way is to use Disable instead of view and change the disabled color to make it looks similar to a regular text box.

Zantarel
Frequent Visitor

I get around this by changing the BorderThickness formula to be an IF statement. 

i.e. if(formname.mode = 0, 2, 0) <- so where the mode is 0 (edit), it'll show a border, else it won't. it can be a pain to go through and change all the fields to be this, but it makes it consistent and it looks better (imho) 

@tmtm...I just tried this.  Of all the hacks...this one is the best solution due to a single click.  No rectangles or backgrounds to mess with.  This is also easily done if you have multiple labels.  Kudos!

 

Now if only Microsoft would fix this ridiculous bug!!!

darrenmuscat
Frequent Visitor

As has been suggested , what worked well for me was to set the DataCard to DisplayMode.Edit instead of Parent.DisplayMode. Also set the border colour of the datacard as follow to get a faint light gray border instead of dark blue used in Edit Mode.

 

BorderColor  fx   If(IsBlank(Parent.Error),If(Parent.DisplayMode=DisplayMode.Edit, Parent.BorderColor,LightGray), Color.Red)

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,307)