Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
640
Databound TabGroupPane bug ?
posted

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.

 

 

 

System.InvalidOperationException was unhandled
  Message="Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."
  Source="PresentationFramework"
  StackTrace:
       at System.Windows.Controls.ItemCollection.CheckIsUsingInnerView()
       at System.Windows.Controls.ItemCollection.RemoveAt(Int32 removeIndex)
       at Infragistics.Windows.DockManager.TabGroupPane.Infragistics.Windows.DockManager.IContentPaneContainer.RemoveContentPane(ContentPane pane, Boolean replaceWithPlaceholder)
       at bq.a(ContentPane A_0, a8 A_1, Nullable`1 A_2, PaneLocation A_3)
       at fd.c(PaneLocation A_0)
       at fd.a(Point A_0, Size A_1)
       at Infragistics.Windows.DockManager.Dragging.FloatPaneAction.PerformAction(fd dragManager, Boolean isPreview)
       at fd.a(MouseEventArgs A_0)
       at fd.a(FrameworkElement A_0, Point A_1, MouseEventArgs A_2, Boolean A_3)
       at fd.a(Object A_0, MouseEventArgs A_1)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at DataboundTabGroupPane.App.Main() in D:\Dev\Infragistics\Pruebas\DataboundTabGroupPane\DataboundTabGroupPane\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[ args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: