c# - 使用条件时如何从 TabbedPage 隐藏选项卡(xamarin 表单)
问题描述
我有以下问题,我有一个系统,当输入时有一个带有 TabbedPage 的 xaml 使用不同的内容页面(例如选项卡),但是当满足某个条件时,我需要其中一个为用户隐藏。
我怎样才能做到这一点?
干杯
解决方案
在页面的构造函数中,只需在添加子页面时检查。我不知道是否有一种简单的方法可以在 XAML 中做同样的事情
public class MyPage : TabbedPage
{
public MyPage()
{
this.Children.Add(new Page1());
this.Children.Add(new Page2());
if (some conditional check based on user)
{
this.Children.Add(new Page3());
}
}
}
推荐阅读
- angular - 轮播指示器呈现为基本标记
- google-bigquery - BigQuery 加载带引号的新行
- c++ - 我不能直接将模板功能传递给 std::apply 但我可以通过 lambda
- android - Android 11 通知抽屉中每个应用的通知限制降至 24 个
- python - How to ensure that TensorFlow saves the average loss across the whole dataset in a training loop written from scratch
- google-cloud-platform - GCP cloudbuild git推送触发器
- android - 我无法让 Flutter 通知图标正常工作
- python - 打开从 .py 文件创建的 exe 文件后是否可以关闭 cmd?
- google-apps-script - GoogleScript - 在 MailApp 中更改“发件人”
- c# - XML 到 SQL 实体框架