After the user changed the layout/configuration of the TabGroupPane and created some ContentPanes in many TabGroupPanes, how to programmatically consolidate ContentPanes in multiple TabGroupPanes into one TabGroupPane?
HI Frankwwu,
I have code snippet below that will consolidate contentpanes from one group to another.
Here a help link on TabGroups:
http://help.infragistics.com/NetAdvantage/WPF/2010.2/CLR4.0/?page=InfragisticsWPF4.DockManager.v10.2~Infragistics.Windows.DockManager.TabGroupPane.html
private void Button_Click(object sender, RoutedEventArgs e)
{
for (int i = tg2.Items.Count - 1; i > -1; i--)
ContentPane cp = (ContentPane) tg2.Items[i];
tg2.Items.RemoveAt(i);
tg1.Items.Add(cp);
}
Sincerely, Matt Developer Support Engineer
.
HI,
I am just following up on this forum thead.
Do you need further assistance regarding this issue?
If you do, please let me know.
Sincerely, MattDeveloper Support Engineer
Thank you for the link. I still can't make it work. Here is my code snip:
public
class ContentPaneFactory : Infragistics.Windows.Extensions.
ContentPaneFactory
public ContentPaneFactory()
ConsolidateCommand =
new DelegateCommand(Consolidate, CanConsolidate);
GlobalCommands.ConsolidateTabsCommand.RegisterCommand(ConsolidateCommand);
#region
ConsolidateCommand
public DelegateCommand ConsolidateCommand { get; private set; }
private void Consolidate()
if (_target is DocumentContentHost
)
DocumentContentHost dch = _target as DocumentContentHost;
for (int i = dch.Panes.Count - 1; i >= 0; i--)
SplitPane sp = dch.Panes[i];
ConsolidateSplitPane(sp);
else if (_target is SplitPane
SplitPane sp = _target as SplitPane;
protected void ConsolidateSplitPane(SplitPane sp)
TabGroupPane tgpKeep = sp.Panes[0] as TabGroupPane
;
for (int j = 1; j < sp.Panes.Count; j++)
TabGroupPane tgp = sp.Panes[j] as TabGroupPane;
for (int
k = 0; k < tgp.Items.Count; k++)
ContentPane cp = tgp.Items[k] as ContentPane;
tgp.Items.RemoveAt(k);
tgpKeep.Items.Add(cp);
private bool
CanConsolidate()
return true;
#endregion
Not sure if I understand correctly about the visual tree.
Thanks,
Frank