1

I have a Dockable Window and that dockable window consists of a dataGrid. In order to populate that data grid I want to pass a datatable and some more parameters.

Here is what I did:

private void SetupDockableWindow(DataTable dt)
    {
        if (_dockableWindow == null)
        {
            IDockableWindowManager dockWindowManager = _application as 
            IDockableWindowManager;
            if (dockWindowManager != null)
            {
                UID windowID = new UIDClass();
                windowID.Value = _dockableWindowGuid;
                //windowID

                _dockableWindow = 
                dockWindowManager.GetDockableWindow(windowID);
                _dockableWindow.Dock(esriDockFlags.esriDockFloat);
            }
        }
    }

How do I pass the required data to it?

0

You implement Dockable Window yourself, so you can do it like this:

public class MyDockableWindow : Form, IDockableWindowDef
{
        public void Fill(DataTable dt)
        {
            // fill your grid
        }
...
        object IDockableWindowDef.UserData
        {
            get { return this; }
        }
...
}

Then you can fill it like this:

((MyDockableWindow)(_dockableWindow.UserData)).Fill(dt);
3
  • Thanks for the response r.pankevicius. I see the example you have shared. You mean to pass a dataTable or any parameter, I need to have created a method and call it with the dt. I understood that. But in case I have some code on the form load event which requires the dt how can I manage. In my case I want the dataGrid to be populated at the load time.
    – royan
    Sep 13 '17 at 11:10
  • The question was "How do I pass the required data to it?". If you want to do it in form load, create data table there and fill grid there, you don't need to pass it from SetupDockableWindow. Sep 14 '17 at 12:47
  • Thanks r.pankevicius for replying. I understood. Thanks again.
    – royan
    Sep 14 '17 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.