I don't understand why nobody is responding to this. Do you need more information?
This seems like this should be a simple thing to do and should have a simple solution. If this control does not have a simple way to programmatically select it's list objects then it needs one. Can I at least get feedback that says you don't know how to do this so that I can move on?
I try this:_explorerBar.ActiveItem = _explorerBar.Groups[0].Items[0]; but get this Exception:"ActiveItem cannot be set - specified Item cannot be activated! (Item may be disabled or have a style that is not activatable like Separator or Label)" _explorerBar.Groups[0].Items[0] is this:UltraExplorerBarItem item = new UltraExplorerBarItem(sectionId.ToString());item.Text = sectionText;_explorerBar.Groups[0].Items.Add(item); What am I missing?
I try this:_explorerBar.ActiveItem = _explorerBar.Groups[0].Items[0];
but get this Exception:"ActiveItem cannot be set - specified Item cannot be activated! (Item may be disabled or have a style that is not activatable like Separator or Label)"
_explorerBar.Groups[0].Items[0] is this:UltraExplorerBarItem item = new UltraExplorerBarItem(sectionId.ToString());item.Text = sectionText;_explorerBar.Groups[0].Items.Add(item);
What am I missing?
Assuming the item is not a separator/label, the likeliest explanation is that the group is not expanded or selected, depending on the value of the control's Style property. Styles like ExplorerBar support the notion of expandable groups, and a group must be expanded before an item therein can be activated. Styles like OutlookNavigationPane support the notion of selectable groups, whereby only one groups is selected at any given time, and only within selected groups can the items therein be activated.
The group is expanded by default.
I just tried doing this:
_explorerBar.Groups[0].Selected = true;
_explorerBar.Groups[0].Items[0].Active = true;
and get this error from the second operation:
ActiveItem cannot be set - specified Item cannot be activated! (Item may be disabled or have a style that is not activatable like Separator or Label)
it is not a separator though the explorerBar might be considering my item a 'Label'...I show in the previous exactly how i instantiated the item, with a simple new command. how do i make the item selectable?
following is the explorerbar designer code:
this._explorerBar.AcceptsFocus = Infragistics.Win.DefaultableBoolean.True;
this._explorerBar.Dock = System.Windows.Forms.DockStyle.Fill;
ultraExplorerBarGroup1.Text = "Sections";
this._explorerBar.Groups.AddRange(new Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarGroup[] {
ultraExplorerBarGroup1});
this._explorerBar.GroupSettings.HeaderButtonStyle = Infragistics.Win.UIElementButtonStyle.WindowsVistaButton;
appearance90.FontData.BoldAsString = "True";
this._explorerBar.ItemSettings.AppearancesSmall.ActiveAppearance = appearance90;
this._explorerBar.ItemSettings.HotTracking = Infragistics.Win.DefaultableBoolean.True;
this._explorerBar.ItemSettings.HotTrackStyle = Infragistics.Win.UltraWinExplorerBar.ItemHotTrackStyle.HighlightEntireItem;
this._explorerBar.Location = new System.Drawing.Point(0, 21);
this._explorerBar.Name = "_explorerBar";
this._explorerBar.Size = new System.Drawing.Size(200, 604);
this._explorerBar.Style = Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarStyle.VisualStudio2005Toolbox;
this._explorerBar.TabIndex = 0;
this._explorerBar.ViewStyle = Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarViewStyle.Office2007;
this._explorerBar.ActiveItemChanged += new Infragistics.Win.UltraWinExplorerBar.ActiveItemChangedEventHandler(this._explorerBar_ActiveItemChanged);
I just tried to set the active item in the immediate window during the activeitemchanged event and it works....
So apparently it works provided my explorerBar is loaded enough?
but I've instantiated the explorerBar and programmatically selecting the first item is literally the last thing i do before the .ShowDialog() method in my form.
So I guess my question now is, is there a Loading() event or some other event i can run off of to activate and select the first item in my list? What event could i use that when fired would ensure the explorerbar to be in a fully loaded state.
The Load event of the dialog you are displaying is probably where you will have to do this. You can hook the Load event right before showing the dialog, then put the ExplorerBar code in that handler. If that doesn't work you might want to attach a sample project so we can tell you exactly why.