Ok so I have started to create an metro application using dotnetbar within visual studio its all working apart from 'CloseModalPanel' my problem is when I try to close the panel from the usercontrol.cs to return back to my main form I am told 'UserControl does not contain a definition for CloseModalPanel' can anyone see what I am doing wrong or what I must do to fix this? Code below:

Main.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MetroStyle
{
    public partial class Main : DevComponents.DotNetBar.Metro.MetroAppForm
    {
        public Main()
        {
            InitializeComponent();
        }

        private void metroTileItem1_Click(object sender, EventArgs e)
        {
            UserControl1 _UserControl = new UserControl1();
            this.ShowModalPanel(_UserControl);
        }

        private void metroTileItem2_Click(object sender, EventArgs e)
        {

        }
    }
}

UserControl.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar.Metro;
using DevComponents.DotNetBar;
using System.Diagnostics;
using DevComponents.AdvTree;
using DevComponents.DotNetBar.Metro.ColorTables;

namespace MetroStyle
{
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        private void buttonX1_Click(System.Object sender, System.EventArgs e)
        {
            //Main.CloseModalPanel(this, DevComponents.DotNetBar.Controls.eSlideSide.Right);

            UserControl1.CloseModalPanel(this, DevComponents.DotNetBar.Controls.eSlideSide.Right);


        }
    }
}

UserControls don't contain a definition for CloseModalPanel, this method is contained within the MetroAppForm class.

Also, for anyone wondering, this is DotNetPanel for WindowsForms by DevComponents. This isn't built into Visual Studio.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.