Is it possilbe to use SfNavigationDrawer to an existing project with an existing activity with layout file?

Hello,
I have seen the examples of how to use SfNavigationDrawer. in a Xamarin.Android project. 
After creating the component, finally, you call the activity method :

SetContentView(navigationDrawer);
I would like to ask you if it is possible to use the component to an existing activity with a full layout file.
 public class MyActivity : Activity
    {
            base.OnCreate(savedInstanceState);
          SetContentView(Resource.Layout.MyActivity);
    }
Is it possible?
Should I have to write every element in the layout file with code and use the property
navigationDrawer.ContentView=ContentFrame;
Any suggestion will be appreciated!

3 Replies

RB Rabhia Beham Kathar Mideenar Syncfusion Team June 13, 2018 09:22 AM UTC

Hi Anestis,

Thanks for contacting Syncfusion Support.

Query 1: I would like to ask you if it is possible to use the component to an existing activity with a full layout file.

We have created a sample using SfNavigationDrawer Control. And yes we can add the SfNavigationControl Control to an existing activity with a full layout file.

Query 2: Should I have to write every element in the layout file with code and use the property.

Yes, we have to write every element in the layout file with code and use the property. Please have the sample from the below link.

Sample Link: http://www.syncfusion.com/downloads/support/forum/138088/ze/NavigationDrawer_Sample1850391239
 

Please check with the sample and let us know if you have any concern.

Regards,
Rabhia Beham K.
 



AK Anestis Katsiamakas June 13, 2018 10:59 AM UTC

Hello Rabhia,

Your sample was perfect! Using the LayoutInflater to load an existing layout and then set the content of the SfNavigationDrawer is working!
I have already used the same technique to an existing project of mine, all is working as expected!

LayoutInflater inflater = LayoutInflater.From(this); // 1
View InflatedContentView = inflater.Inflate(Resource.Layout.ContentLayout1, null);
  drawer.DrawerContentView = InflatedDrawerView;

Thank you very much for the quick and correct response!


RB Rabhia Beham Kathar Mideenar Syncfusion Team June 14, 2018 04:34 AM UTC

Hi Anestis,

Thanks for the update.

We are glad that you have achieved your requirement. Please let us know if you need any further assistance.

Regards,
Rabhia Beham K.


Loader.
Up arrow icon