Hi!
When I add a new ContentPane to a DocumentContentHost by code the tab always appears at the first position. But I want to add it on the last position. I can't find any property to change this for the TabGroupPane or for the position of the ContentPane itself. How can I add the Document on the last position?
Here is my code:
XAML:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igDock="http://infragistics.com/DockManager" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="MainWindow" x:Name="Window" Title="MainWindow" Width="640" Height="480"> <Grid x:Name="LayoutRoot"> <igDock:XamDockManager x:Name="XamDM"> <igDock:DocumentContentHost x:Name="DCH"> <igDock:SplitPane> <igDock:TabGroupPane> <igDock:ContentPane Header="Content Pane"> <Grid> <Button Height="25" Width="50" Content="Klick" Name="Button1" /> </Grid> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> </igDock:XamDockManager> </Grid> </Window>
VB.net:
Imports Infragistics.Windows.DockManager Class MainWindow Private NewContentPane As ContentPane Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click NewContentPane = XamDM.AddDocument("NewContentPane", New TextBox) End Sub End Class
Greetings,
voks
The AddDocument method will always place the ContentPane it creates at the first position. I'm not sure what you mean by the last position in the tab strip (i.e. the last actual index in the items collection or the last one in view) but if you want it at the last slot in the items collection then you can probably just get the logical parent of the ContentPane that is returned (e.g. using LogicalTreeHelper.GetParent), cast that to a TabGroupPane, remove the ContentPane from the tab group's Items collection and add it to the Items collection at the end.
Note: As I believe I've mentioned in other posts, it should be noted that the default panel used in the TabGroupPane when hosted in the DocumentContentHost is a custom virtualizing panel that only creates the first n tabs that fit in view so whenever a pane is activated in a document TabGroupPane and the tab item is not in view (or more accurately there isn't a tabitem associated with it), it will be moved to the first item in the Items collection just as happens in VS when you activate a pane that is not in view.
Thank you for your answer. Now this code works as I wanted it:
Imports Infragistics.Windows.DockManager Class MainWindow Private NewContentPane As ContentPane Dim Counter As Integer = 0 Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click NewContentPane = XamDM.AddDocument("NewContentPane" & Counter, New TextBox) Dim Tgp As TabGroupPane = LogicalTreeHelper.GetParent(NewContentPane) Tgp.Items.Remove(NewContentPane) Tgp.Items.Add(NewContentPane) Counter = Counter + 1 End Sub End Class