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

SfNavigationDrawer ToggleDrawer fails because IToggleDrawer cannot be resolved?

Thread ID:

Created:

Updated:

Platform:

Replies:

129243 Mar 7,2017 02:30 AM UTC Mar 13,2017 05:37 AM UTC Xamarin.Forms 5
loading
Tags: SfNavigationDrawer
Emil
Asked On March 7, 2017 02:30 AM UTC


Hi,

Sometimes for me this code is failing     DependencyService.Get<Syncfusion.SfNavigationDrawer.XForms.IToggleDrawer>().ToggleDrawer();

I get the following exception. Are you familie with this? Can I imagive why it may fail? I see in my exception logs often. please let me know

{System.ArgumentException: Handle must be valid.
Parameter name: instance
  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00017] in /Users/builder/data/lanes/4009/9578cdcd/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11612 
  at Android.Runtime.JNIEnv.CallVoidMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x00000] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/Mono.Android/JNIEnv.g.cs:258 
  at Com.Syncfusion.Navigationdrawer.SfNavigationDrawer.ToggleDrawer () [0x00043] in <3a5714c2fd5843329de0fa7c826e422b>:0 
  at Syncfusion.SfNavigationDrawer.XForms.Droid.ToggleDrawer_Android.Syncfusion.SfNavigationDrawer.XForms.IToggleDrawer.ToggleDrawer () [0x00007] in <7cbe0b03d61741178bc3612a9bac0a76>:0 
 
 

Vanaja  Annasamy [Syncfusion]
Replied On March 7, 2017 12:17 PM UTC

Hi Emil,

We were unable to reproduce the reported issue “ Getting exception while using ToogleDrawer in NavigationDrawer in Android”. We have created sample for your reference. Please download the same from below link.

Link: http://www.syncfusion.com/downloads/support/forum/129243/ze/NavigationDrawer_129243115290297 

Please run the sample and check whether the issue still persists at your end. If not, please apply your changes and revert the modified sample that would help us to work inline with your requirement.

Regards,
Vanaja R.A.

 


Emil
Replied On March 8, 2017 12:21 PM UTC

Hi,

thank you for quick response. I am not able reproduce this error in a fresh project unfortunately. it seems like again something else in my big project is triggering this error. Until I figure this out and provide you a sample. can you please answer me following questions?

1) what is difference between using?
DependencyService.Get<IToggleDrawer>().ToggleDrawer();
and navigationDrawer.ToggleDrawer(); //x:Name="navigationDrawer" in xaml
2) IsOpen attrribute is bindable. it works when I bind it using MVVM. but strange thing is It works only 1 time or first time when I raise change on this attribute. why doesnt it work everytime I raise a change event on it.
3) is there anyway I can control ToggleDrawer using MVVM?

EDIT: further what i found in the output is as below
03-08 13:13:17.112 W/View    (25770): requestLayout() improperly called 
by md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer{e2adc2e V.E...C.. ......ID 0,72-1080,1776 #4} 
during second layout pass: posting in next frame

Vanaja  Annasamy [Syncfusion]
Replied On March 9, 2017 01:17 PM UTC

Hi Emil,

Query 1: What is difference between using navigationDrawer.ToggleDrawer(); and DependencyService.Get<IToggleDrawer>().ToggleDrawer();

DependencyService:

DependencyService are used to invoke only single instance.

ToggleDrawer:

In case of multiple navigationDawer on multiple pages we can’t invoke the drawer based on DependencyService. So, for this scenario we must use ToggleDrawer method to invoke drawer.

Query 2: IsOpen attrribute is not working properly while binding

We were unable to reproduce the reported issue “IsOpen attrribute is not working properly while binding”. We have created sample for your reference. Please download the same from below link.


Link: http://www.syncfusion.com/downloads/support/forum/129243/ze/NavigationDrawer_IsOpen-378814457 

Please let us know if you have concern on this.

Regards,
Vanaja R.A.
 


Emil
Replied On March 10, 2017 09:43 AM UTC

Hi Vanaja,

thanks for your quick reply. I confirm that IsOpen works fine. I think that I was missing to set Mode=TwoWay. 

Regards,

Emil

Vanaja  Annasamy [Syncfusion]
Replied On March 13, 2017 05:37 AM UTC

Hi Emil,

Thank you for your update. We are glad that you have achieved your requirement.

Regards,
Vanaja R.A.


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.

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

;