假设我的 PowerApps 应用程序中有一个下拉控件,其中包含以下项目:
[
"1. Calculator",
"2. Counter",
"3. API",
"4. Collections",
"5. Dropdown",
"6. Acceleration",
"7. Camera"
]
我想通过它的名字导航到一个屏幕。就像是
Navigate(Nav.Selected.Value, ScreenTransition.Cover)
有可能以某种方式做吗?是否有一个按其名称返回控件的函数?
Navigate(GetControl(Nav.Selected.Value), ScreenTransition.Cover)
因为现在我必须使用If函数在应用程序中导航,如下所示:
Navigate(If(
"1" in Nav.Selected.Value, Screen1,
"2" in Nav.Selected.Value, Screen2,
"3" in Nav.Selected.Value, Screen3,
"4" in Nav.Selected.Value, Screen4,
"5" in Nav.Selected.Value, Screen5,
"6" in Nav.Selected.Value, Screen6,
"7" in Nav.Selected.Value, Screen7),
ScreenTransition.Cover)
这看起来不太好。有更优雅的解决方案吗?