private void ActivateDatagrid(DataSource ds)
        {
            TabItem ti = null;

            if (controller != null && ds != null)
            {
                ti = controller.GetTabItem(ds);
                if (ti != null)
                {
                    ti.IsSelected = true;
                    ti.Focus();
                }
            }
        }
        public FindVargridWindow()
        {
            InitializeComponent();
            container  = LifetimeService.Instance.Container;
            controller = container.Resolve <IUIController>();
            ds         = controller.GetActiveDocument();
            TabItem ti = controller.GetTabItem(ds);

            dp = ti.Content as DataPanel;
            //dp.datavartabs.SelectedIndex = 1;//switch to DATA tab
            appWin     = LifetimeService.Instance.Container.Resolve <Window1>();
            this.Owner = appWin;
            searchtext.Focus();
        }
        public FindDatagridWindow()
        {
            InitializeComponent();

            container  = LifetimeService.Instance.Container;
            controller = container.Resolve <IUIController>();
            ds         = controller.GetActiveDocument();
            TabItem ti = controller.GetTabItem(ds);

            dp = ti.Content as DataPanel;

            appWin     = LifetimeService.Instance.Container.Resolve <Window1>();
            this.Owner = appWin;
            //fill listbox with colnames of currently active dataset
            FillColnames();
            searchtext.Focus();
        }
        public FindVargridWindow(Window1 appwin)
        {
            InitializeComponent();
            container  = LifetimeService.Instance.Container;
            controller = container.Resolve <IUIController>();
            ds         = controller.GetActiveDocument();
            if (ds == null || ds.Variables == null || ds.Variables.Count < 1)//12Sep2016 For NULL dataset we can disable the textfield and the Next button
            {
                DisableDialog();
            }
            TabItem ti = controller.GetTabItem(ds);

            dp = ti.Content as DataPanel;
            //dp.datavartabs.SelectedIndex = 1;//switch to DATA tab
            appWin     = appwin;
            this.Owner = appWin;
            searchtext.Focus();
        }
        private string GetActiveTabOfActiveDataset()
        {
            container  = LifetimeService.Instance.Container;
            controller = container.Resolve <IUIController>();
            ds         = controller.GetActiveDocument();
            TabItem ti = controller.GetTabItem(ds);

            dp = ti.Content as DataPanel;
            if (dp.datavartabs.SelectedIndex == 0)//datagrid is active
            {
                return("datagrid");
            }
            else if (dp.datavartabs.SelectedIndex == 1) //vargrid is active
            {
                return("vargrid");
            }
            else //something strange
            {
                return(string.Empty);
            }
        }