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?
1 Answer 1
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);
answered Sep 13, 2017 at 7:51
-
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– royan2017年09月13日 11:10:02 +00:00Commented Sep 13, 2017 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.Remigijus Pankevičius– Remigijus Pankevičius2017年09月14日 12:47:48 +00:00Commented Sep 14, 2017 at 12:47
-
Thanks r.pankevicius for replying. I understood. Thanks again.royan– royan2017年09月14日 14:25:46 +00:00Commented Sep 14, 2017 at 14:25
lang-cs