We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Way to Have ListView.DragIndicatorView Not Visible if ListView DragStartMode Set to None?

Thread ID:

Created:

Updated:

Platform:

Replies:

144861 May 26,2019 02:06 PM UTC May 28,2019 12:41 PM UTC Xamarin.Forms 3
loading
Tags: SfListView
Robert
Asked On May 26, 2019 02:06 PM UTC

I have a Listview that I toggle from DragStartMode.None to DragStartMode.OnDragIndicator in code behind depending on a UI click.

I can't see a straight forward way to have the DragIndicatorView IsVisable = false if the DragStartMode is set to None and IsVisible = true if the DragStartMode is set to OnDragIndicator.

Is there a simple way do this?  I can think of a way to do this by adding a field to my data like ShowDragIndicator and implimenting an IValueConverter.  But this seems complicated for what should be inherently part of the control. Or at least a property like DontShowIfDragStartModeNotOnDragIndicator.

Any suggestions appreciated.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 27, 2019 02:19 PM UTC

Hi Robert, 
 
Thank you for contacting Syncfusion support. 
  
We would like to inform, you can achieve your requirement simply by binding the DragStartMode property directly to DragIndicatorView like below instead binding viewModel property. You can change the visibility of the DragValueConverter based on the DragStartMode value. But using converter is the only option to change the value of indicator. We regret to inform you that we cannot option to provide the bool property in source as per your requirement though it can be achieved in sample itself. 
  
Please find the sample for your reference, 
  
  
[Xaml] 
     <listView:SfListView x:Name="listView"DragStartMode="None" 
                          ItemsSource="{Binding ContactItems}" 
                          ItemSpacing="0,0,5,0"> 
  
                <listView:SfListView.ItemTemplate> 
                    <DataTemplate> 
                        <ViewCell> 
                            <ViewCell.View> 
                              <Grid > 
                                 <listView:DragIndicatorView ListView="{x:ReferencelistView}" IsVisible="{Binding DragStartMode, Source={x:ReferencelistView},Converter={StaticResource dragValueConverter}}}"> 
                                   <Grid > 
                                       <Image Source="DragIndicator.png" /> 
                                   </Grid> 
                                 </listView:DragIndicatorView> 
                              </Grid> 
                            </ViewCell.View> 
                        </ViewCell> 
                    </DataTemplate> 
                </listView:SfListView.ItemTemplate> 
            </listView:SfListView> 
  
Converter 
public class DragValueConverter : IValueConverter 
{ 
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
        { 
            var dragMode = (DragStartMode)value ; 
            if (dragMode == DragStartMode.OnHold || dragMode == DragStartMode.OnDragIndicator) 
                return true; 
            else 
                return false; 
        } 
  
        public object ConvertBack(object value, Type targetType, objectparameter, CultureInfo culture) 
        { 
            throw new NotImplementedException(); 
        } 
} 
  
Please let us know if you need any further assistance. 
 
Regards,
Subburaj Pandian V     
 


Robert
Replied On May 27, 2019 04:30 PM UTC

That was what I needed. I thought I might need an IValueConverter.  But I wasn't sure how to address the listView control and property.  Your way lets me do it without creating an extra field in the DB. 

I do still think this is the way the DragIndicatorView should work natively, perhaps with a property like ShowDragIndicator = "OnDragIndicator" (default) or "Always" or "OnHold" or "OnHoldOrOnDragIndicator".  

Anyway, my opinion.

Thanks for the help.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 28, 2019 12:41 PM UTC

Hi Robert 
  
Thank you for your valuable suggestion.  
 
We are glad that the solution provided meets your requirement. We have already provided DragIndicator with IsVisibleproperty to change its visible state and it can be achieved at the application level itself. So, considering that separate API will not be a feasible requirement. However, based on the number of traffic on this requirement, we will consider it in the future. 
  
Regards,
Subburaj Pandian V 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon