- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试将一些自定义内容页面放入选项卡式页面中。遗憾的是,我不确定如何使用 XAML 语法执行此操作。我的虚拟项目如下所示:
第 1 页
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.Pages.Page1">
<Label Text="Page 1" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>
第2页完全一样。标签页:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.Pages.Navigation">
<ContentPage x:Class="MyApp.Pages.Page1" Title="Home">
</ContentPage>
<ContentPage x:Class="MyApp.Pages.Page2" Title="Browse">
</ContentPage>
</TabbedPage>
页面就是不显示?我怎样才能正确地做到这一点?
最佳答案
你做错了。您必须将页面放置为 TabbedPage 子项。
解决方法如下:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mypages="clr-namespace:MyApp.Pages;assembly=MyApp"
x:Class="MyApp.Pages.Navigation">
<TabbedPage.Children>
<mypages:Page1 Title="Home"/>
<mypages:Page2 Title="Browse"/>
</TabbedPage.Children>
</TabbedPage>
或者,您可以通过编程方式进行:
public class TabsPage : TabbedPage
{
public TabsPage ()
{
this.Children.Add (new Page1 () { Title = "Home" });
this.Children.Add (new Page2 () { Title = "Browse" });
}
}
关于c# - Xamarin 表格 : ContentPages in TabbedPage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37744472/
我的 Xamarin 项目中有多个 ContentPage xaml 文件。我想将一个共享的 xaml 嵌入到每个 ContentPage 中。共享的 xaml 部分没有什么特别之处(它不需要做任何特
有没有办法判断当前是否显示了 ContentPage? 我需要在 ContentPage 的事件处理程序中编写代码来检查页面当前是否显示并采取相应行动。 最佳答案 除了GBreen12的回答,你也可以
通常,使用 NavigationStack 弹出当前页面: Navigation.PopAsync( true ); 如何使用Navigation重绘当前页面之前的页面? 背景:当前页面更改了一
我有一些 XAML ContentPages 上面有 ContentView 对象。因此,通常我会根据在 ContentPage 中设置的 this.Width 和 this.Height 值来调整这
我正在使用Xamarin表单来生成由更多ContentPages组成的TabbedPage。这是导致麻烦的代码部分: public void launchMainDesign(object s
我试图通过在 App.xaml 中定义一个设置 BackgroundColor 属性的隐式样式来全局更改我的应用程序中所有 ContentPage 控件的背景。 虽然 Xamarin 中的隐式样式似乎
我试过这个:iPhone MonoTouch - Get Version of Bundle NSBundle.MainBundle.ObjectForInfoDictionary("CFBundle
我正在 ~/View.cshtml 尝试一个非常简单的内容页面,其中包含 @inherits ViewPage @{ Layout = "SimpleLayout";
我有一个 ContentPage 类。 我在类中创建一个任务并具有以下简单的代码: async Task ScoutingTimeThread() { while (true) {
这是我的代码: ..... 有大量的标签,以至于它们从
我有以下内容页面,我想在其中加载 Steema Teechart,但我不能,因为我无法使 MainPage 异步: 我的主页: public class MainPage : ContentPage
Xamarin.Forms VS2013 开发环境 我知道还有其他关于此的主题,但它们没有回答我的问题。 对于 Android,背景图片效果很好。 BackgroundImage = Device.O
我正在尝试将一些自定义内容页面放入选项卡式页面中。遗憾的是,我不确定如何使用 XAML 语法执行此操作。我的虚拟项目如下所示: 第 1 页 第2页完全一样。标签页:
我试图设置 ContentsPage BackgroundImage,但在大屏幕设备上图像一直平铺。 这里有人知道如何阻止图像平铺吗? 已编辑 这是 iPad 上发生的事情的图像。 这是它在手机上的样
如何创建一个基本的 contentpage 类来继承 xamarin 表单? 我关注了这个 forum咨询。 一切都很好,直到我必须解决 Xaml 部分。 using System; using Xa
我有 ContentView在 CarouselPage .我导航到 ConentPage来自 ContentView .更新 ContentPage并返回 ContentView . 现在,在这张纸
我有一个具有以下页面结构的应用程序: MainPage ->SettingsPage ->InputLanguagePage
是否可以从母版页访问位于内容页中的控件(使用内容占位符,更准确地说是多 View 控件)? 情况是,我在母版页中有一个带有按钮的菜单。 现在在我的内容页面中,我有 1 个内容占位符。具有多个 View
最近在 Xamarin 工作,如果我尝试为 ContentPage 设置样式,似乎什么也没有发生 App.xaml 的 ResourceDictionary 中的 Xaml: 我知道正在
我有以下 Contentpage.content,我在其中设置了某些绑定(bind)上下文。 在 Post.xaml.cs (ContentView) 中,我尝试以这种方式获
我是一名优秀的程序员,十分优秀!