How to access to all properties of controls within listview and how to display rows according to Date

12 Views Asked by At

I want to access to controls nested in listview to some properties. Namely I want to change Porperties like isEnabled is checked. I want also display according to date like yyyy-MM-dd. In list view I selected that button edit should control if control should be enabled or not.

My listview:

<ListView
x:Name="ExpiryProductsData"
SelectionMode="Single"
ItemSelected="ExpiryProductsData_ItemSelected"
SeparatorColor="LightGray"
SeparatorVisibility="Default">
<ListView.ItemTemplate>
    <DataTemplate>
        <ViewCell>
            <StackLayout
                Orientation="Horizontal"
                VerticalOptions="Center">
                <Entry
                    Text="{Binding Description}"
                    TextColor="Black"
                    VerticalOptions="Center"
                    IsEnabled="False"/>
                <DatePicker
                    Date ="{Binding DateExpiry}"
                    TextColor="Black"
                    IsEnabled = "{Binding IsEnabledControl}"
                    VerticalOptions="Center"
                    DateSelected="DatePicker_DateSelected"
                    PropertyChanged="DatePicker_PropertyChanged"
                    />
                <StackLayout
                    Orientation="Horizontal"
                    HorizontalOptions="EndAndExpand">
                    <Button
                       x:Name="EditData"           // I want that this button makes 
                                                   // datapicker control other controls 
                                                   // within listview
                        Clicked="EditData_Clicked"
                        TextTransform="None"
                        Text="Edytuj"
                        CornerRadius="5"
                        VerticalOptions="Center"
                        CommandParameter="{Binding .}"/>
                </StackLayout>
            </StackLayout>
          </ViewCell>
      </DataTemplate>
   </ListView.ItemTemplate>

My model:

 class ModelClass
 {
    public string Description { get; set; }
    public string ExpiryDate { get; set; }
    public IsEnabled IsEnabledControl { get; set; } 
 }
0

There are 0 best solutions below