我正在使用Xamarin.form制作应用程序 .
我创建了tableview,它有三个来自xaml的部分 . 我想隐藏或删除最后一节(整个部分,带sectionTitle) .
但不幸的是,Xamarin xaml不支持条件处理 . (仅当元素具有isVisible属性但tableSection没有它时才有效)
我可以做任何选择吗?
谢谢 .
是的,您可以动态删除部分执行以下操作:
XAML:
<TableView x:Name="Table"> <TableSection x:Name="Section"> <TextCell Text="something"/> </TableSection> <TableSection x:Name="Section2"> <TextCell Text="something2"/> </TableSection> </TableView>
代码背后:
Table.Root.Remove(Section);
-要么-
Table.Root.Remove(0); //If you know the index of the section
如果你需要在某个时候添加它,请务必将其存储在代码后面的变量中,然后再将其删除:
TableSection section = Table.Root[0];
TableSection section = Table.Root.IndexOf(Section);
1 回答
是的,您可以动态删除部分执行以下操作:
XAML:
代码背后:
-要么-
如果你需要在某个时候添加它,请务必将其存储在代码后面的变量中,然后再将其删除:
-要么-