Xamarin表单-选项卡式视图? [英] Xamarin Forms - Tabbed View?
问题描述
我需要创建一个弹出窗口,其中会有一些选项卡,每个选项卡都包含一个列表视图.我知道这里有一个TabbedPage,但是我需要一个"TabbedView",以便可以使用Xlabs PopupLayout构建我的弹出窗口.如何在Xamarin表单中执行此操作?
I need to create a popup, in which there will be some tabs, each of them containing a listview. I know that there is a TabbedPage, but I need a "TabbedView" so I can build my popup using the Xlabs PopupLayout. How do I do this in Xamarin Forms?
推荐答案
您可以自己创建一个自定义控件.
You can create a custom control yourself.
(假设您要创建3个标签)
(imagine you want to create 3 tabs)
例如,您可以查看一个2行3列的网格.
For example you can have a view that it's a grid with 2 rows and 3 columns.
设置按钮的第一行将RowHeight设置为auto或所需的大小,然后将每个按钮添加到每一列.
1st row you set the buttons set the RowHeight to auto or a size you want, and add each button to each column.
在第2行上,您可以拥有一个ContentView,其RowHeight为*(以填充其余空间),还应将GridSpan设置为3列,这样它将填充网格上所有可用的宽度.
On row 2 you can have a ContentView with RowHeight of * (to fill the rest of the space) , you should also set GridSpan to 3 columns so it will fill all width available on the grid.
然后,当您单击按钮时,只需将ContentView视图设置为该特定选项卡所需的内容即可.在更改内容之前,您还可以制作动画.
Then when you click a button you just have to set the ContentView view to what you want for that particular tab., you can also have animations before changing the content.
希望有帮助
这篇关于Xamarin表单-选项卡式视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!