Style, PaneSource and Save/Load layout

4 posts, 0 answers
  1. Gladky
    Gladky avatar
    3 posts
    Member since:
    Dec 2013

    Posted 18 Dec 2013 Link to this post

    Hello.

    Here is code of my window:
    <telerik:RadDocking x:Name="radDocking" PanesSource="{Binding Panes}">
            <telerik:RadDocking.Resources>
                <Style x:Key="RadPaneCustomStyle" TargetType="{x:Type telerik:RadPane}" BasedOn="{StaticResource RadPaneStyle}">
                    <Setter Property="Header" Value="{Binding Header}" />
                    <Setter Property="ToolTip" Value="{Binding ToolTip}" />
                    <Setter Property="IsHidden" Value="{Binding IsHidden, Mode=TwoWay}" />
                    <Setter Property="IsActive" Value="{Binding IsActive, Mode=TwoWay}" />
                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                </Style>
                <Style TargetType="{x:Type telerik:RadPane}" BasedOn="{StaticResource RadPaneCustomStyle}">
                    <Setter Property="CanDockInDocumentHost" Value="True" />
                </Style>
                <Style TargetType="{x:Type telerik:RadDocumentPane}" BasedOn="{StaticResource RadPaneCustomStyle}">
                    <Setter Property="CanDockInDocumentHost" Value="True" />
                </Style>
            </telerik:RadDocking.Resources>
     
            <telerik:RadDocking.DockingPanesFactory>
                <docking:CustomDockingPanesFactory />
            </telerik:RadDocking.DockingPanesFactory>
            <telerik:RadDocking.CurrentSaveLoadLayoutHelper>
                <docking:CustomSaveLoadLayoutHelper />
            </telerik:RadDocking.CurrentSaveLoadLayoutHelper>
     
            <telerik:RadSplitContainer InitialPosition="DockedLeft">
                <telerik:RadPaneGroup x:Name="leftGroup" telerik:RadDocking.SerializationTag="leftGroup" />
            </telerik:RadSplitContainer>
     
            <telerik:RadSplitContainer InitialPosition="DockedRight">
                <telerik:RadPaneGroup x:Name="rightGroup" telerik:RadDocking.SerializationTag="rightGroup" />
            </telerik:RadSplitContainer>
     
            <telerik:RadSplitContainer InitialPosition="DockedBottom">
                <telerik:RadPaneGroup x:Name="bottomGroup" telerik:RadDocking.SerializationTag="bottomGroup" />
            </telerik:RadSplitContainer>
        </telerik:RadDocking>

    public void SaveLayout()
    {
        var docking = DockingManager as RadDocking;
     
        using (var stream = File.Open(GetLayoutFilePath(State), FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
        {
            docking.SaveLayout(stream);
        }
    }
     
    public void LoadLayout(WorkspaceState state)
    {
        var docking = DockingManager as RadDocking;
     
        using (var stream = File.Open(GetLayoutFilePath(State), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            docking.LoadLayout(stream);
        }
    }

    So, the problem is:
    When i create some pads and save/load layout and dont hide or pin it it's ok. But when i pin it loose the style, so header become empty.
    When i am hiding it and restoring, there is exseption:
    System.InvalidOperationException was unhandled
      HResult=-2146233079
      Message=Cannot modify the logical children for this node at this time because a tree walk is in progress.
      Source=PresentationFramework
      StackTrace:
           at System.Windows.FrameworkElement.RemoveLogicalChild(Object child)
           at MS.Internal.Controls.InnerItemCollectionView.ClearModelParent(Object item)
           at MS.Internal.Controls.InnerItemCollectionView._RemoveAt(Int32 index, Int32 indexR, Object item)
           at MS.Internal.Controls.InnerItemCollectionView.Remove(Object item)
           at System.Windows.Controls.ItemCollection.Remove(Object removeItem)
           at Telerik.Windows.Controls.RadPaneGroup.CloseSinglePane(RadPane pane) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPaneGroup.cs:line 1522
           at Telerik.Windows.Controls.RadPaneGroup.ClosePane(RadPane pane) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPaneGroup.cs:line 653
           at Telerik.Windows.Controls.RadDocking.HidePane(RadPane pane) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 430
           at Telerik.Windows.Controls.RadPane.Close() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 1461
           at Telerik.Windows.Controls.RadPane.OnIsHiddenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 1226
           at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           at System.Windows.StyleHelper.ApplyStyleOrTemplateValue(FrameworkObject fo, DependencyProperty dp)
           at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList`1& exclusionContainerDependents, FrugalStructList`1& oldContainerDependents, FrugalStructList`1& newContainerDependents)
           at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
           at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
           at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
           at System.Windows.FrameworkElement.UpdateStyleProperty()
           at System.Windows.TreeWalkHelper.InvalidateStyleAndReferences(DependencyObject d, ResourcesChangeInfo info, Boolean containsTypeOfKey)
           at System.Windows.TreeWalkHelper.OnResourcesChanged(DependencyObject d, ResourcesChangeInfo info, Boolean raiseResourceChangedEvent)
           at System.Windows.FrameworkElement.OnAncestorChangedInternal(TreeChangeInfo parentTreeState)
           at System.Windows.TreeWalkHelper.OnAncestorChanged(DependencyObject d, TreeChangeInfo info, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
           at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
           at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
           at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
           at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
           at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
           at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
           at MS.Internal.PrePostDescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
           at System.Windows.TreeWalkHelper.InvalidateOnTreeChange(FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, Boolean isAddOperation)
           at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
           at System.Windows.FrameworkElement.AddLogicalChild(Object child)
           at System.Windows.LogicalTreeHelper.AddLogicalChild(FrameworkElement parentFE, FrameworkContentElement parentFCE, Object child)
           at MS.Internal.Controls.InnerItemCollectionView.SetModelParent(Object item)
           at MS.Internal.Controls.InnerItemCollectionView.Add(Object item)
           at System.Windows.Controls.ItemCollection.Add(Object newItem)
           at Telerik.Windows.Controls.RadDocking.AddSplitContainer(RadSplitContainer radSplitContainer) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 309
           at Telerik.Windows.Controls.Docking.DockingLayoutFactory.LoadDocking(XmlReader reader) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\DockingLayoutFactory.cs:line 236
           at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source, Boolean raiseEventsIfNoSerializationTag) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.Layout.cs:line 77
           at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.Layout.cs:line 58
           at GameEd.IDE.Services.WorkspaceService.LoadLayout(WorkspaceState state) in d:\TFS\GameEd-Telerik\IDE\GameEd.IDE\Services\WorkspaceService.Layout.cs:line 107
           at GameEd.IDE.Services.WorkspaceService.LoadLayout() in d:\TFS\GameEd-Telerik\IDE\GameEd.IDE\Services\WorkspaceService.Layout.cs:line 96
           at Catel.MVVM.Command`2.Execute(TExecuteParameter parameter, Boolean ignoreCanExecuteCheck)
           at Catel.MVVM.Command`2.Execute(TExecuteParameter parameter)
           at Catel.MVVM.Command`2.Execute(Object parameter)
           at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
           at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
           at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.DispatcherOperation.InvokeImpl()
           at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Threading.DispatcherOperation.Invoke()
           at System.Windows.Threading.Dispatcher.ProcessQueue()
           at System.Windows.Threading.Dispatcher.WndProcHook(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, Int32 numArgs)
           at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
           at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
           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.PushFrameImpl(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
           at System.Windows.Threading.Dispatcher.Run()
           at System.Windows.Application.RunDispatcher(Object ignore)
           at System.Windows.Application.RunInternal(Window window)
           at System.Windows.Application.Run(Window window)
           at System.Windows.Application.Run()
           at GameEd.App.Main() in d:\TFS\GameEd-Telerik\GameEd\obj\Debug\obj\Debug\decoratedxaml\App.g.cs:line 0
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:

    If i remove IsHidden binding it's work perfectly.
  2. Gladky
    Gladky avatar
    3 posts
    Member since:
    Dec 2013

    Posted 22 Dec 2013 Link to this post

    Solver.

    Moved Stylex to App resource dictionary.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 23 Dec 2013 Link to this post

    Hello Gladky,

    We are glad that the issue is resolved.

    Please feel free to write to us again if you have any other questions regarding our controls.

    Regards,
    Konstantina
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  5. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 17 Jun 2015 in reply to Konstantina Link to this post

    Gladky excuse me , can you please help me with save layout and catel?

    Thanks

Back to Top