You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Power Apps中实现屏幕间导航及分类详情联动展示?

Power Apps: Screen Navigation & Filtered Category Display

Hey there! Let's tackle your questions step by step—starting with basic screen navigation, then diving into your specific category filtering scenario.

1. How to Navigate Between Screens in Power Apps

The core tool for screen navigation is the Navigate() function, and it’s super straightforward to set up:

  • Add an interactive control (like a button, or a label with OnSelect enabled) to your first screen.
  • Set the control’s OnSelect property to Navigate(YourTargetScreenName), replacing YourTargetScreenName with the actual name of your second screen (e.g., Navigate(Screen2)).
  • To let users return to the first screen, add a button on the second screen and set its OnSelect property to Back().

For extra polish, you can add transition effects with a second parameter—like Navigate(Screen2, ScreenTransition.Fade) for a smooth fade-in animation.

2. Filtering Second Screen Results by Selected Category

For your scenario where clicking a category on the first screen shows only that category’s details on the second, here are two reliable approaches:

Option 1: Using a Global Variable (Simple for Small Apps)

  • On your first screen, select the Carpet button and set its OnSelect property to:
    Set(varSelectedCategory, "Carpet"); Navigate(Screen2)
    
  • Repeat this for the other buttons, updating the category value:
    • Hardwood button: Set(varSelectedCategory, "Hardwood"); Navigate(Screen2)
    • Tile button: Set(varSelectedCategory, "Tile"); Navigate(Screen2)
  • On the second screen, use the Filter() function to narrow your data source to the selected category. If you’re using a Gallery to display subcategories, set its Items property to:
    Filter(YourDataSource, Category = varSelectedCategory)
    
    Replace YourDataSource with the name of your actual data source (e.g., a SharePoint list, Dataverse table, or collection holding category details).

Option 2: Using Context Variables (Cleaner for Isolated Data)

If you want to avoid global variables (to prevent unintended side effects in larger apps), pass the category directly via the Navigate() function’s context parameter:

  • For the Carpet button’s OnSelect:
    Navigate(Screen2, None, {ctxSelectedCategory: "Carpet"})
    
  • Update the other buttons similarly (e.g., {ctxSelectedCategory: "Hardwood"} for the Hardwood button).
  • On the second screen, reference the context variable in your Gallery’s Items property:
    Filter(YourDataSource, Category = ctxSelectedCategory)
    

Either method will ensure that when a user clicks a category on the first screen, the second screen only loads the matching subcategory data.


内容的提问来源于stack exchange,提问作者Mufaddal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 20:57:29