Comments (16)
Something like that
<StackLayout BindableLayout.ItemsSource="{Binding Items}">
<BindableLayout.ItemTemplate>
<exp:ExpandableView>
.....
</exp:ExpandableView>
</BindableLayout.ItemTemplate>
</StackLayout>
from expandableview.
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.
Thanks I will give it a whirl and possibly create a sample ContentPage Pull request for addition to the sample app
from expandableview.
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.
@BicycleMark would be super :)
i look forward to see PR ))
from expandableview.
@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.
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 , 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.
Oh, your xaml in totally wrong
from expandableview.
I will try binding the stacklayout out that has the expandable view.
I will update you if that works.
from expandableview.
@AndreiMisiukevich, Excellent, many thansk Mr. Andrei
from expandableview.
from expandableview.
great )
from expandableview.
@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, 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.
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)
- Please sample of usage with Binding from XAML HOT 8
- Next level of view HOT 6
- Select Item in View Programmatically HOT 3
- Secondary view doesn't resize when (eg) rotating the device HOT 11
- [Feature Request]: Scroll To Secondary View If Out Of Bounds HOT 9
- ScrollView Not showing in Sample Code HOT 4
- TouchHandlerView Property and CommandProperty HOT 8
- Collapsing and expanding is leaving empty space where SecondaryView was HOT 2
- Last item in list view - expanding not immediately allowing scroll to reveal secondary-view HOT 11
- Random Cells Do Not Expand/Collapse HOT 1
- Expand an item one at a time HOT 2
- Can you add SecondaryView for xaml? HOT 1
- Cell is overlapping on each other. HOT 1
- x:Name in ExpandableView.SecondaryViewTemplate HOT 2
- Make Expander control HOT 2
- gif not shown HOT 2
- [Enhancement] Add OnExpanding and OnCollapsing events. HOT 3
- Second ExpanderView PrimaryView height issue when First Status changes to Expanded iOS - CollectionView HOT 6
- NaNis not valid for height in IOS HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expandableview.