- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试创建一个包含元素 TextCell 和 SwitchCell 的 ViewCell。
这是我的代码-
<ListView x:Name="AlarmList" HasUnevenRows="True" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<TextCell TextColor="#CCCCCC" Text="{Binding Name}" DetailColor="Red" Detail="{Binding Address}"></TextCell>
<SwitchCell />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
我得到的错误是:
cannot convert from 'Xamarin.Forms.TextCell' to 'Xamarin.Forms.View'
替代方法是使用这些
<Label ></Label>
<Switch ></Switch>
最佳答案
StackLayout
需要一个 View
对象,它基本上是任何 UI 元素,但不是 Cell
。您可以使用 Xamarin Forms 附带的预定义单元格,如果您想推迟使用它来编写自己的布局。
您的开端不错,但您不能使用单元格。所以丢掉它们,然后按照您想要的方式布局 ViewCell
。
关于c# - 无法从 'Xamarin.Forms.TextCell' 转换为 'Xamarin.Forms.View',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44007132/
当我单击 ListView 中的 TextCell 时,该行会突出显示。 但是,当我以编程方式选择一行/一个 TextCell 时,该行未突出显示。 因此,除非用户通过点击一行来更改选择,否则无法向用
如何在 ListView 的 TextCell 中包装文本?我试过设置 HasUnevenRows至 True但这没有帮助。 最佳答案 您不能使用 Xamarin 的“开箱即用”TextCell 功能
我正在尝试从文本单元格中捕获 onclick 事件。为什么这不触发点击事件 - TextCell tempCell = new TextCell() { @Ov
我已经使用字符串和整数将详细信息传递给下一个Form,并将它们存储在类的中构造函数,现在如何将构造函数中的值(参数化值)绑定(bind)到 TableView 中的 TextCell。 最初,这就是我
这是我现在正在使用的代码... items = new List(); items.Add(new TextCell { Text = "Cake", TextColor = Colo
为什么我不能在 ListView 项模板中使用这样的 TextCell?当我使用它时,行呈现但它们是空的。
我有一个场景,我需要获取所选 TextCell 的值并使用它来更新 ListView 之外的标签。我注意到 ListView 有一个 SelectedItem 属性,而 TextCell 有一个 Co
我想知道,如何根据条件更改 ListView 中文本单元格的颜色。不管是背景颜色还是文本颜色,我只想根据条件突出显示某些行。下面是我的代码示例。
我正在使用 Eureka Forms和 SearchTextField . 在我的表单中,我想要一些与 (Eureka) 内置的非常相似的东西 TextRow .不同的是这个自定义TextRow将使用
我正在尝试创建一个包含元素 TextCell 和 SwitchCell 的 ViewCell。 这是我的代码-
我无法在 ListView 中绑定(bind)多个 TextCell。如果只有一个,它工作正常,但在添加更多时给出 XamlParseException。尝试绑定(bind)标签时发生相同的异常。这就
我需要将我的货币单元格放在网格上以显示本地货币符号,右对齐并以红色显示负数。 与类似的帖子不同,我使用实时绑定(bind)从数据集中填充我的 TGrid。 其他解决方案建议从 TStringCell
GWT Javadoc 迷你教程中的代码如下所示: TextCell textCell = new TextCell(); CellList cellList = new CellList(textC
我是一名优秀的程序员,十分优秀!