Вот мой файл шаблона xaml:
<Switch IsToggled="{Binding ShowSubItems}" Grid.Row = "0" Grid.Column = "1" HorizontalOptions = "Start" Margin = "10,8,8,0"></Switch>
, за которым следует:
<ListView x:Name="lvItemSigns" HasUnevenRows="True" SeparatorVisibility="Default" SeparatorColor="Gray" Margin =" 8">
Я связываю ячейку данных с этим списком следующим образом:
lvItemSigns.ItemTemplate = new DataTemplate(typeof(DataCell));
class DataCell : ViewCell{
public DataCell()
{
var grid = new Grid();
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto});
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
label = new Label();
label.TextColor = Color.Black;
label.SetBinding(Label.TextProperty, "SubItemCode");
label.Margin = 4;
grid.Children.Add(label, 1, 3);
label = new Label();
label.TextColor = Color.Black;
label.SetBinding(Label.TextProperty, "SubItemDescription");
label.Margin = 4;
label.SetBinding(Label.IsVisibleProperty, new Binding("SubItemDescription", BindingMode.Default, new BooleanConverter()));
grid.Children.Add(label, 1, 4);
}
Как скрыть эти две метки от каждой ячейки данных списка при переключении переключателя.
Спасибо