Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

CircularListView ContextAction or Long Holding action #326

Closed
EmilAlipiev opened this issue Jun 15, 2020 · 2 comments · Fixed by #332
Closed

CircularListView ContextAction or Long Holding action #326

EmilAlipiev opened this issue Jun 15, 2020 · 2 comments · Fixed by #332
Assignees
Labels
enhancement New feature or request sos-masters Samsung Open Source Masters Program

Comments

@EmilAlipiev
Copy link
Contributor

I cannot figure out if ContextActions working for CircularListView or not? I simply tried like below but nothing happening. What is the best way to delete an item from the list? is there any contextactions or long holding action?

 <cui:CircleListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.ContextActions>
                            <MenuItem Command="{Binding DeleteItem}"
                                      CommandParameter="{Binding .}"
                                      Text="Delete" IsDestructive="True" />
                        </ViewCell.ContextActions>
                        <Label Text="{Binding Name}"
                               VerticalOptions="Center"
                               HorizontalOptions="Center"
                               VerticalTextAlignment="Center"
                               HorizontalTextAlignment="Center">
                            
                        </Label>
                    </ViewCell>
                </DataTemplate>
            </cui:CircleListView.ItemTemplate>
@EmilAlipiev EmilAlipiev added the enhancement New feature or request label Jun 15, 2020
@rookiejava
Copy link
Contributor

rookiejava commented Jun 16, 2020

Hi @EmilAlipiev, thanks for reaching out!
This is good question. As you said, this feature is currently missing from the Tizen implementation. We’re internally working on some ideas to make it possible to select items through long press and perform user-defined action. We’ll share them soon. Thanks! 🤙

*update
Of course, even now you can implement it by using the ContextPopupEffectBehavior together in the app, but we are discussing to provide the function with the listview/cell itself for better usability.

@EmilAlipiev
Copy link
Contributor Author

EmilAlipiev commented Jun 17, 2020

@rookiejava thanks for the suggestion. I try to implement like in the XUIComponents sample

ItemLongPressed is defined on GenList in ElmSharp namespace. i thought CircleListView inherits from xamarin.listview. How does it work together with GenList ? I am able to bind Command but somehow Commandparameter doesnt work for me.

So i have implemented like below. can I expect a the single item as I long press on a single item on the list? or effect:ItemLongPressEffect Command is executed on the entire CircleListView ? so it will return all Items as Commandparameter?

            <cui:CircleListView x:Name="List"
                                AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
                                AbsoluteLayout.LayoutFlags="All"
                                IsGroupingEnabled="True"
                                HasUnevenRows="True"
                                GroupDisplayBinding="{Binding Key}"
                                ItemsSource="{Binding Items}"
                                SelectedItem="{Binding SelectedItem}"
                                effect:ItemLongPressEffect.Command="{Binding Path=BindingContext.LongClickCommand, Source={x:Reference Name=List}}" 
                                effect:ItemLongPressEffect.CommandParameter="{Binding .}">

 public Command LongClickCommand
        {
            get
            {
                return new Command<Item>((item) =>
                {

                    
                });
            }
        }

I have tried to implement it also Grid inside viewcell as below using {Binding .} but i am not able to get the current item as Commandparameter. I am not sure if there is a problem with Commandparameter implementation.

  <cui:CircleListView.GroupHeaderTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <Grid HorizontalOptions="FillAndExpand"
                                      VerticalOptions="FillAndExpand"
                                      BackgroundColor="Transparent"
                                      effect:ItemLongPressEffect.Command="{Binding Path=BindingContext.LongClickCommand, Source={x:Reference Name=List}}"
                                      effect:ItemLongPressEffect.CommandParameter="{Binding .}">

@rookiejava rookiejava added the sos-masters Samsung Open Source Masters Program label Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request sos-masters Samsung Open Source Masters Program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants