I am doing a prototype where I need to populate a TabGroupPane dynamically but via Binding instead of programmatically as shown in the xamFeatureBrowser.
In the XAML I have the following:
<Window x:Class="DataboundTabGroupPane.Window1" 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:local="clr-namespace:DataboundTabGroupPane" Title="DataBound TabGroupPane" Width="640" Height="380"> <Window.Resources> <ObjectDataProvider x:Key="dataProvider" ObjectType="{x:Type local:TabList}"/> </Window.Resources> <Grid Background="LightBlue"> <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> </Grid.ColumnDefinitions> <igDock:XamDockManager Grid.Row="0" x:Name="dockManager"> <igDock:DocumentContentHost > <igDock:SplitPane > <igDock:TabGroupPane ItemsSource="{Binding Path=TabContent,Source={StaticResource dataProvider}}" > </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> </igDock:XamDockManager> </Grid></Window>
TabList.cs
using System.Collections.ObjectModel;using System.Windows.Controls;using Infragistics.Windows.DockManager;namespace DataboundTabGroupPane{ public class TabList { ObservableCollection<ContentPane> _tabs = null; public ObservableCollection<ContentPane> TabContent { get { if (this._tabs == null) { _tabs = new ObservableCollection<ContentPane>(); ContentPane contentPane = new ContentPane (); contentPane.Header = "Document #1"; RichTextBox rtb = new RichTextBox(); contentPane.Content=rtb; _tabs.Add(contentPane); contentPane = new ContentPane(); contentPane.Header = "Document #2"; rtb = new RichTextBox(); contentPane.Content = rtb; _tabs.Add(contentPane); contentPane = new ContentPane(); contentPane.Header = "Document #3"; rtb = new RichTextBox(); contentPane.Content = rtb; _tabs.Add(contentPane); } return _tabs; } } }}
TabGroupPane gets populated but when trying to dragging one tab I am getting the next exception.
I can send you the VS project if you need it.
Thanks,Claudio.
We don't support binding the ItemsSource of the TabGroupPane because we need to be able to manipulate the collection moving items into and out of the TabGroupPane. ContentPanes are designed to be discrete entities that exist separately but can be grouped by the end user.
Ouch are there any workarounds? This is going to be a sticking point in using Composite application library + mv vm.
Yes I came up with a very similar solution. Good blog. Thanks for the info.
You could use the approach/code that I provided in this blog post.
never mind. I know you can just add (remove) the panes in the Model View but it sure would be nice to be able to utilize ItemSource though.