Dynamic Binding in ListView to show/hide element

Hi,

I have a ListView which consists of objects that within have a list of other objects. I'm able to do the binding correctly and I can have each element showing all of its child elements in the ui. Then each child element has an Entry.

I have two problems (first one only happens in Android).

First the Entry is not clickable (I have the latest Xamarin updates). If you click it you just can't type anything. (Android only)
Second: I need to make this item visible/invisible depending on a user click over the parent's element. Now how can I accomplish this with binding? I have 3 parents items with childs each, how can I only tell one of the parents to display the child on click.

Hope I made my self clear here is a piece of code:

<ListView ItemsSource="{Binding ParentObjects}" CachingStrategy="RecycleElement" HasUnevenRows="True">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                                <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                                    <StackLayout    Orientation="Horizontal" BackgroundColor="#ADAFAF" HorizontalOptions="FillAndExpand" Spacing="10" Padding="10,0,10,0" HeightRequest="75">
                                        <Label  Text="{Binding ParentObjectName}" TextColor="#007AC9" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
                                        <Image Source="CommentEmpty.png" HorizontalOptions="End" HeightRequest="32" WidthRequest="32" VerticalOptions="Center"></Image>
                                        <Image Source="DownArrow.png" HorizontalOptions="End"  HeightRequest="32" WidthRequest="32" VerticalOptions="Center"></Image>
                                    </StackLayout>
                                    <Editor HeightRequest="175" IsVisible="False"></Editor>
                                </StackLayout>
                                <ListView ItemsSource="{Binding ChildObjects}" CachingStrategy="RecycleElement" IsVisible="True" HasUnevenRows="True">
                                    <ListView.ItemTemplate>
                                        <DataTemplate>
                                            <ViewCell>
                                                <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" Padding="2,0,2,0">
                                                    <Label  Text="{Binding ChildObjectName}" TextColor="#5EB6E4" FontAttributes="Bold" HorizontalOptions="StartAndExpand" VerticalOptions="Center" />
                                                    <Entry HorizontalOptions="EndAndExpand" WidthRequest="100"></Entry>
                                                    <Image Source="CommentEmpty.png" HeightRequest="24" WidthRequest="24" VerticalOptions="Center" HorizontalOptions="End"></Image>
                                                    <Editor HeightRequest="175" IsVisible="False"></Editor>
                                                </StackLayout>
                                            </ViewCell>
                                        </DataTemplate>
                                    </ListView.ItemTemplate>
                                </ListView>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

Thanks

Sign In or Register to comment.