我创建了一个sftabView,每个sfTabItem都有一个ContentView,所以我创建了另一个View来在这个ContentView中显示它。所以问题是如何实现这一点?这是我想在ContentPage中显示的ContentView
<?xml version="1.0" encoding="utf-8" ?>
<ContentView
xmlns="http://xamarin.com/schemas/2014/forms"
x:Class="App5.Views.Self_Trainig"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
NavigationPage.HasNavigationBar="False">
<ContentView.Resources>
<ResourceDictionary>
............
</ResourceDictionary>
</ContentView.Resources>
<ContentView.Content>
<AbsoluteLayout>
...............
</AbsoluteLayout>
</ContentView.Content>
</ContentView>
这是我的内容页:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:tabView="clr-namespace:Syncfusion.XForms.TabView;assembly=Syncfusion.SfTabView.XForms"
x:Class="App5.Views.Accueil">
<ContentPage.Content>
<tabView:SfTabView OverflowMode="DropDown" VisibleHeaderCount="3" BackgroundColor="White">
<tabView:SfTabItem Title="Self Training">
<tabView:SfTabItem.Content>
""the code to display it here""
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
<tabView:SfTabItem Title="Contacts">
<tabView:SfTabItem.Content>
<Grid BackgroundColor="White" x:Name="ContactsGrid" />
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
</tabView:SfTabView>
</ContentPage.Content>
</ContentPage>
2条答案
按热度按时间smdncfj31#
说明:
xmlns:...
定义。<mynamespace:Self_Trainig ... />
类名的元素...
:在类名之后,可以添加任何需要的属性,就像其他ContentView一样。BindableProperty
。正确执行这些操作超出了本答案的范围;还有其他关于这个主题的问答。lymnna712#
可以用C#代码显示视图吗?
我的意思是
内容视图x:名称=“TheView”
在C#代码上做一些类似于
视野=自我训练
我知道代码不起作用,但我正在寻找这种解决方案