将值传递到另一个屏幕 [英] Pass a value to another screen

查看:57
本文介绍了将值传递到另一个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个屏幕,用户可以在其中选择一个选项(不是浏览库,因为它没有执行所需的操作).

我想将用户选择的项目传递给浏览库使用的预制DetailScreen1".

我查看了浏览屏幕,但没有看到它是如何工作的,因为导航 onselect 事件只是普通导航.

代码:

Navigate(DetailScreen1, ScreenTransition.Fade)

我想做类似的事情

Navigate(DetailScreen1, ScreenTransition.None {Last(listOfStuff)})

谢谢

解决方案

你可以使用

在向右箭头"中,我们可以设置以下 OnSelect 属性:

Navigate(ProductsScreen, ScreenTransition.Fade, { selectedSection: Dropdown1.Selected.Value })

在 ProductsScreen 中,您可以拥有一个图库,其项目根据传递的值进行过滤:

Items: Filter(AllProducts, Section = selectedSection)

I have a screen where the user can select an option (not a browse gallery as it does not do what is required).

I want to pass the item the user has selected to the pre-made "DetailScreen1" which is used by the browse gallery.

I looked at the browse screen but did not see how it does it as the navigate onselect event is just normal navigation.

Code:

Navigate(DetailScreen1, ScreenTransition.Fade)

I want to do something like

Navigate(DetailScreen1, ScreenTransition.None {Last(listOfStuff)})

Thanks

解决方案

You can use the third parameter of the Navigate function to pass extra parameters to the context of the screen being navigated to. For example, if your first screen has a dropdown and a text input control that you want to pass the values to the next screen, you can use the following expression:

Navigate(DetailScreen1, ScreenTransition.Fade, { text: TextInput1.Value, dropdownChoice: Dropdown1.Selected.Value })

In the DetailScreen1, you can use those context variables as they'll be available.

Here's an example: the dropdown in the first screen contains a list of sections, and after selecting one you would navigate to another page:

In the "right arrow", we can set the following OnSelect property:

Navigate(ProductsScreen, ScreenTransition.Fade, { selectedSection: Dropdown1.Selected.Value })

In the ProductsScreen, you can then have a gallery whose items are filtered based on that value that was passed:

Items: Filter(AllProducts, Section = selectedSection)

这篇关于将值传递到另一个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆