Samsung / Tizen.CircularUI

Tizen Wearable CircularUI project is to develop an open source software motivate software developer to creating Tizen Wearable Xamarin Forms app more easily and efficiently.
Other
80 stars 32 forks source link

CircularListView ContextAction or Long Holding action #326

Closed EmilAlipiev closed 4 years ago

EmilAlipiev commented 4 years ago

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>
rookiejava commented 4 years ago

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 commented 4 years ago

@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 .}">