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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SelectionMode="SingleDeselect" doesnt work when navigating back to the page from another page

Thread ID:

Created:

Updated:

Platform:

Replies:

128416 Jan 19,2017 11:40 PM UTC Jan 20,2017 09:53 AM UTC Xamarin.Forms 1
loading
Tags: SfDataGrid
Emil
Asked On January 19, 2017 11:40 PM UTC

When navigating to a details page from a sfdatagrid selecteditem and coming back to this page as you know that sfdatagrid view selecteditem will remain. This is a default behaviour also xamarin.forms listview. 
Problem here is you can re-select the previously selecteditem If it was navigated back to this page. I thought that SingleDeselect Mode is perfect solution in this scenario. So I could click to "Deselect" and click again to "Reselect" but this doesnt work.

So my questions are is it intended to be like that or a bug? If either of them, now how can I refresh the selection. I tried 2 diffrent things.
1) SelectedItem=null; 
     RaisePropertyChanged("SelectedItem"); this doesnt work even in xaml SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
2) 
     private void dataGrid_GridTapped(object sender, GridTappedEventsArgs e)
        {
            listWorkouts.Opacity = 1.0;
            listWorkouts.IsEnabled = true;
            if((sender as SfDataGrid).SelectedItem !=null)               
               listWorkouts.SelectionController.ClearSelection();
        }

this event is not getting fired when I tap on SelectedItem. 
So what other option do I have? 

PS, please make sure that we understand each other. I talk only about navigating back to the page.  

Divakar Subramaniam [Syncfusion]
Replied On January 20, 2017 09:53 AM UTC

Hi Emil, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query. We assumed that you have navigated to the next page through SfDataGrid.SelectionChanged event. If you set SelectionMode as “SingleDeSelect” then the selection changed event will be fired both while selecting and deselecting. That might be the reason in your case. However, you can overcome this by using the below code snippet. 
private void DataGrid_SelectionChanged(object sender, GridSelectionChangedEventArgs e) 
{ 
    if (e.AddedItems.Count > 0) 
        this.Navigation.PushAsync(new DetailsPage()); 
} 
 
We have attached a simple sample for your reference and you can download the same from the below link. 
 
If your query or requirement is not related to the case we have mentioned, then please do revert us with the clear information about your query along with modified sample reproducing the issue which will help us to analyze further. 
 
Regards, 
Divakar. 
 


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

or the page will be automatically redirected to 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

;