Giter Club home page Giter Club logo

Comments (16)

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024 2

Something like that

<StackLayout BindableLayout.ItemsSource="{Binding Items}">
    <BindableLayout.ItemTemplate>
        <exp:ExpandableView>
            .....
        </exp:ExpandableView>
    </BindableLayout.ItemTemplate>
</StackLayout>

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024 1

Unfortunately it's impossible to use ExpandableView in ListView

But you can use StackLayout as holder and use BindableLayout which was contributed by @andreinitescu (Hi Andrei haha)

more info: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/bindable-layouts

from expandableview.

BicycleMark avatar BicycleMark commented on June 16, 2024 1

Thanks I will give it a whirl and possibly create a sample ContentPage Pull request for addition to the sample app

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024 1

it should look like smth like that @ali-h2010

<StackLayout BindableLayout.ItemsSource={Binding Items}>
    <BindableLayout.ItemTemplate>
        <expandable:ExpandableView x:Name="expandableView" 
                   BackgroundColor="Red"
                   TouchHandlerView="{x:Reference arrow}"
                   CommandParameter="some text"
                   Command="{Binding Path=TapCommand, Source={x:Reference page}}"
                   ExpandAnimationLength="100">         
            <expandable:ExpandableView.PrimaryView>
                <StackLayout Orientation="Horizontal">
                    <Label Text="Expandable view" FontSize="30" VerticalTextAlignment="Center"/>
                    <Image x:Name="arrow" Source="arrow_drop_down.png" HeightRequest="60" WidthRequest="60" HorizontalOptions="EndAndExpand"/>
                </StackLayout>
            </expandable:ExpandableView.PrimaryView>
            <expandable:ExpandableView.SecondaryViewTemplate>
                <DataTemplate>
                    <StackLayout Padding="5">
                        <Label Text="Item" FontSize="Large"/>
                        <Label Text="Item" FontSize="Large"/>
                        <Label Text="Item" FontSize="Large"/>
                        <Label Text="Item" FontSize="Large"/>
                        <Label Text="Item" FontSize="Large"/>
                    </StackLayout>
                </DataTemplate>
            </expandable:ExpandableView.SecondaryViewTemplate>
        </expandable:ExpandableView>
    </BindableLayout.ItemTeamplate>
</StackLayout>

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024

@BicycleMark would be super :)
i look forward to see PR ))

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

@AndreiMisiukevich , can i use bindable layout on the whole collapsing item to generate multiple expandable views at run time?
expandable:ExpandableView supports BindableLayout but i am not sure how to pass the layoutTemplate as ExpandableView takes ExpandableView.PrimaryView and ExpandableView.SecondaryViewTemplate

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

When i tried the following, i got an error:

Error: XLS0415: The attachable property 'PrimaryView' was not found in type 'ExpandableView'.
Error: XLS0415: The attachable property 'SecondaryViewTemplate' was not found in type 'ExpandableView'.

<expandable:ExpandableView x:Name="expandableView" 
                           BackgroundColor="Red"
                           TouchHandlerView="{x:Reference arrow}"
                           CommandParameter="some text"
                           Command="{Binding Path=TapCommand, Source={x:Reference page}}"
                           ExpandAnimationLength="100">
             <BindableLayout.ItemTemplate>
                <DataTemplate>            
                    <expandable:ExpandableView.PrimaryView>
                        <StackLayout Orientation="Horizontal">
                            <Label Text="Expandable view" FontSize="30" VerticalTextAlignment="Center"/>
                            <Image x:Name="arrow" Source="arrow_drop_down.png" HeightRequest="60" WidthRequest="60" HorizontalOptions="EndAndExpand"/>
                        </StackLayout>
                    </expandable:ExpandableView.PrimaryView>
                    <expandable:ExpandableView.SecondaryViewTemplate>
                        <DataTemplate>
                            <StackLayout Padding="5">
                                <Label Text="Item" FontSize="Large"/>
                                <Label Text="Item" FontSize="Large"/>
                                <Label Text="Item" FontSize="Large"/>
                                <Label Text="Item" FontSize="Large"/>
                                <Label Text="Item" FontSize="Large"/>
                            </StackLayout>
                        </DataTemplate>
                    </expandable:ExpandableView.SecondaryViewTemplate>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </expandable:ExpandableView>

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024

@AndreiMisiukevich , can i use bindable layout on the whole collapsing item to generate multiple expandable views at run time?
expandable:ExpandableView supports BindableLayout but i am not sure how to pass the layoutTemplate as ExpandableView takes ExpandableView.PrimaryView and ExpandableView.SecondaryViewTemplate

Show me what are you trying to achieve

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024

Oh, your xaml in totally wrong

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

I will try binding the stacklayout out that has the expandable view.
I will update you if that works.

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

@AndreiMisiukevich, Excellent, many thansk Mr. Andrei

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

It's working perfectly
Screen Shot 2020-02-24 at 3 38 28 PM

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024

It's working perfectly
Screen Shot 2020-02-24 at 3 38 28 PM

great )

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

@AndreiMisiukevich, do you have any suggestion on how to hook the expanding event so i can change the icon accordingly or take an action? I know this is not suppose to be used in a bindable layout but this is my last challenge :)

from expandableview.

AndreiMisiukevich avatar AndreiMisiukevich commented on June 16, 2024

@AndreiMisiukevich, do you have any suggestion on how to hook the expanding event so i can change the icon accordingly or take an action? I know this is not suppose to be used in a bindable layout but this is my last challenge :)

I suggest using triggers (observe IsExpanded property). Or any other approach

from expandableview.

ali-h2010 avatar ali-h2010 commented on June 16, 2024

Just a small warning that i didn't notice before if you are planning to use bindable layouts:

Bindable layouts should only be used when the collection of items to be displayed is small, and scrolling and selection isn't required. While scrolling can be provided by wrapping a bindable layout in a ScrollView, this is not recommended as bindable layouts lack UI virtualization. When scrolling is required, a scrollable view that includes UI virtualization, such as ListView or CollectionView, should be used. Failure to observe this recommendation can lead to performance issues.

https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/bindable-layouts

from expandableview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.