是否有一种禁用/禁用ListView中的ViewCell的方式?我一直在浏览文档,但找不到任何东西。到目前为止,这就是我所拥有的。
<ListView x:Name="lvNotes" ItemSelected="OnSelection">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Object.Name}" Detail="{Binding Object.Subject}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
要更改背景,您可以轻松使用触发器。
这是您的listView示例,但带有触发器。当属性Object.IsActive设置为false时,网格背景将变为灰色。
<ListView x:Name="lvNotes" ItemSelected="OnSelection">
<ListView.ItemTemplate>
<DataTemplate>
<Grid BackgroundColor="Green">
<TextCell Text="{Binding Object.Name}" Detail="{Binding Object.Subject}"/>
<Grid.Triggers>
<DataTrigger TargetType="Grid" Binding="{Binding Object.IsActive}" Value="False">
<Setter Property="BackgroundColor" Value="Gray"/>
</DataTrigger>
</Grid.Triggers>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句