CS0117 Resource.id does not contain a definition for 'Toolbar'

ElijahMankeElijahManke Member ✭✭
edited November 2018 in Xamarin.Android
    protected override void OnCreate(Bundle savedInstanceState)
    {
        AppCenter.Start("205d4461-a6fc-4dd2-aa56-c41d59448548", typeof(Analytics), typeof(Crashes));

        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.activity_main);


        Android.Support.V7.Widget.Toolbar toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
        SetSupportActionBar(toolbar);


        FloatingActionButton fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
        fab.Click += FabOnClick;`

I'm quite new to Xamarin and to C# and I was wondering why the toolbar in (Resource.id.toolbar) is not even a part of the group and why its the only thing that breaks my code

Tagged:

Answers

  • BillyLiuBillyLiu Member, Xamarin Team Xamurai

    @ElijahManke

    Could you reproduce this issue in other projects?
    You could try to clean your project and manually delete bin and obj folder, restart VS then rebuild your project.

Sign In or Register to comment.