Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Programmatically selecting a DockItem (Read 873 times)
MavinTech
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 19
Joined: Jul 30th, 2020
Programmatically selecting a DockItem
Nov 19th, 2021 at 7:10pm
Print Post  
I have a DockControl that has several DockItems in it and each Item contains a graphic display.  Is there a was to bring one of the items to be the current as if it was clicked on?  If someone tries to open a new DockItem that is already there, I want to select the item for them.
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3153
Joined: Oct 19th, 2005
Re: Programmatically selecting a DockItem
Reply #1 - Nov 22nd, 2021 at 11:08am
Print Post  
Try this method:

Code
Select All
void ActivateItem(DockItem item)
{
    var parent = item.Parent as DockWindowBase;
    if (parent != null)
        parent.SelectedIndex = parent.Items.IndexOf(item);
}

void ActivateItem(string id)
{
    var list = new List<DockItem>();
    dockControl.GetAllDockItems(list);
    foreach (var item in list)
    {
        if (item.Id == id)
        {
            ActivateItem(item);
            return;
        }
    }
} 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint