简体   繁体   English

如何在 PowerApps 中将颜色设置为全局变量?

[英]How to set a color as a global variable in PowerApps?

I am trying to set predefined colors in PowerApps using the function Set , however, when I check the variables tab the variable does not have a value (NA).我正在尝试使用Set函数在 PowerApps 中设置预定义颜色,但是,当我检查变量选项卡时,该变量没有值 (NA)。

The syntax on the option OnStart I am using is as follows:我使用的OnStart选项的语法如下:

Set(LightOrange, ColorValue("#ee7f00"))

Can anyone help me solve this issue?谁能帮我解决这个问题?

Nothing wrong in what you're doing.你在做什么没有错。 You cannot see that LightOrange variable value what you're setting in OnStart under Variables area like debug mode.您看不到LightOrange变量值您在OnStart Variables区域(如调试模式)下设置的内容。

I'm seeing arunColor variable with No value .我看到arunColor变量No value 在此处输入图片说明

I'm assigning #0000ff (Blue) using Set from App OnStart我正在使用 App OnStart Set分配#0000ff (蓝色) 在此处输入图片说明

I'm assigning that variable value arunColor as control color Fill我将该变量值分配给arunColor作为控制颜色Fill 在此处输入图片说明

I'll use one of these urls to access the App after save & publish.保存和发布后,我将使用这些 url 之一来访问应用程序。

https://apps.powerapps.com/play/d68b7936-xxxx-xxxx-xxxx-ce064e3f1637
https://apps.powerapps.com/play/d68b7936-xxxx-xxxx-xxxx-ce064e3f1637?tenantId=e485c427-xxxx-xxxx-xxxx-add2e5942a49

Voila!瞧! I see the control color changed.我看到控件颜色发生了变化。 在此处输入图片说明

Reason :原因
OnStart is designed to trigger when the app is opened very first time. OnStart旨在在第一次打开应用程序时触发。 If you make changes in color, then you have to open the App again to see the changes.如果您对颜色进行了更改,则必须再次打开应用程序才能看到更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM