This is a migrated thread and some comments may be shown as answers.

NullReferenceException with Catel and RadPaneGroup

2 Answers 105 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Klemens
Top achievements
Rank 1
Klemens asked on 02 Apr 2014, 07:59 AM
Hi,
I have a RadPaneGroup where I want to add the items on a button click.
So:

<telerik:RadDocking.DocumentHost>
 <telerik:RadSplitContainer>
  <telerik:RadPaneGroup ItemsSource="{Binding RecordItems}">
   <telerik:RadPaneGroup.ContentTemplate>
    <DataTemplate>
     <views:RecordTabView DataContext="{Binding}"/>
    </DataTemplate>
   </telerik:RadPaneGroup.ContentTemplate>
   <telerik:RadPaneGroup.ItemTemplate>
    <DataTemplate>
     <TextBlock Text="{Binding Title}"/>
    </DataTemplate>
   </telerik:RadPaneGroup.ItemTemplate>
  </telerik:RadPaneGroup>
 </telerik:RadSplitContainer>
</telerik:RadDocking.DocumentHost>


On button click I add a new RecordTabViewModel to the collection.
This works perfect the content and the header are displayed correctly.
But an error occurs when I want to switch between the Tabs:

System.NullReferenceException wurde nicht behandelt.
  HResult=-2147467261
  Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  Source=Telerik.Windows.Controls.Docking
  StackTrace:
       bei Telerik.Windows.Controls.RadPane.OnHeaderMouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
       bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       bei System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
       bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       bei System.Windows.EventRoute.ReInvokeHandlers(Object source, RoutedEventArgs args)
       bei System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       bei System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)
       bei System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
       bei System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       bei System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       bei System.Windows.RouteItem.InvokeHandler(RoutedEventArgs routedEventArgs)
       bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       bei System.Windows.EventRoute.InvokeHandlers(Object source, RoutedEventArgs args)
       bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       bei System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       bei System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       bei System.Windows.Input.InputManager.ProcessStagingArea()
       bei System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       bei System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       bei System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       bei System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       bei System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       bei System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       bei System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       bei System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
       bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       bei System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       bei System.Windows.Threading.Dispatcher.Run()
       bei System.Windows.Application.RunDispatcher(Object ignore)
       bei System.Windows.Application.RunInternal(Window window)
       bei System.Windows.Application.Run(Window window)
       bei System.Windows.Application.Run()
       bei EtaStudio.App.Main() in d:\Firma\Projekte\Visual Studio\Visual Studio 2013\Projects\EtaSoftware\EtaStudio\obj\x86\Debug\App.g.cs:Zeile 0.
       bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       bei System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       bei System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Regards Markus

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 03 Apr 2014, 11:47 AM
Hello Markus,

In the current version of RadDocking the ItemsSource property of a RadPaneGroup is not supported. You can take a look at all the non supported properties in this help article.

Fortunately with our latest versions of RadDocking we introduced a brand new built-in feature to improve the MVVM support in the RadDocking control. In the latest versions of the control you could take advantage of the PanesSource and the DockingPanesFactory in order to implement a MVVM friendly approach of adding and managing RadPane instances in the control. More detailed information about the PanesSource  and DockingPanesFactory functionality can be found here.

Regards,
Vladi
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Klemens
Top achievements
Rank 1
answered on 07 Apr 2014, 05:02 AM
Thank you very much!

Regards Markus
Tags
Docking
Asked by
Klemens
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Klemens
Top achievements
Rank 1
Share this question
or