Load layout doesn't work

4 posts, 0 answers
  1. Dhaval
    Dhaval avatar
    17 posts
    Member since:
    Feb 2011

    Posted 28 Jun 2011 Link to this post

    Hi All,

    I have used docking control with save & load layout.
    Save layout working perfect
    private string SaveLayout()
           {
               string xml;
               // Save your layout for example in the isolated storage.
               using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
               {
                   using (var isoStream = storage.OpenFile("RadDocking_Layout.xml", FileMode.OpenOrCreate))
                   {
                       this.DockingMyDashBoard.SaveLayout(isoStream);
                       isoStream.Seek(0, SeekOrigin.Begin);
                       StreamReader reader = new StreamReader(isoStream);
                       xml = reader.ReadToEnd();
                   }
               }
               // Return the generated XML
               return xml;
           }

    but i have a problem with load layout

    private void LoadLayout()
           {
               // Load your layot from the isolated storage.
              // LoadDashboardLayout();
               
               using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
               {
                   using (var isoStream = storage.OpenFile("RadDocking_Layout.xml", FileMode.Open))
                   {
                       this.DockingMyDashBoard.LoadLayout(isoStream);
                        
                   }
               }
                
               //StringReader stringReader = new StringReader(xmlText);
               //MemoryStream stream = new MemoryStream(System.Text.UTF8Encoding.Default.GetBytes(xmlText));
           //xmlSerializer.Deserialize(new StringReader(xmlText));
           //    Stream s = new MemoryStream(ASCIIEncoding.Default.GetBytes(xmlText));
             //  this.DockingMyDashBoard.LoadLayout(stream);
           }

    It's give me the Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) Error

    So, Please help me to resolved this issue

    Thanks,
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 30 Jun 2011 Link to this post

    Hi Dhaval,

     We are not aware of such a problem with the Docking control's LoadLayout method. Could you please give us some more detailed information about your scenario - are you sure that the file exists where you are trying to find it, what XML is written into this file? If you could send us a sample project that reproduces the problem we will be able to better assist you resolving the issue.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Gaurang
    Gaurang avatar
    29 posts
    Member since:
    Dec 2010

    Posted 04 Aug 2011 Link to this post

    Hi,

    I am facing same problem (with above code) and getting error like "Error HRESULT E_FAIL has been returned from a call to a COM component." when restore the Layout.

    I use below code for load layout

    private void LoadLayout(string layoutxml)
    {
        byte[] byteArray = Encoding.Unicode.GetBytes(layoutxml);
        using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
        {
            using (var isoStream = storage.OpenFile("LoadLayout" + App.CurrentUser.UserId.ToString() + ".xml", FileMode.OpenOrCreate))
            {
                isoStream.Write(byteArray, 0, byteArray.Length);
                this.DockingMyDashBoard.LoadLayout(isoStream);
                isoStream.Close();
                storage.DeleteFile("LoadLayout" + App.CurrentUser.UserId.ToString() + ".xml");
            }
        }
    }


    My XAML code is
    <RadDock:RadDocking x:Name="DockingMyDashBoard" HasDocumentHost="False" AllowUnsafeMode="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0" Grid.Column="1">
      <RadDock:RadSplitContainer Name="schedulerspliter" InitialPosition="DockedLeft" Orientation="Vertical" MinHeight="0" MaxHeight="1000" MinWidth="0" MaxWidth="1000" Width="305" RadDock:RadDocking.SerializationTag="schedulerspliter">
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroup1">
          <RadDock:RadPane x:Name="PaneCalender" RadDock:RadDocking.SerializationTag="PaneCalender"
                                                            CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Calender" MaxHeight="1000" MaxWidth="1000" MinHeight="0" MinWidth="0" Width="Auto">
            <telerikScheduler:RadScheduler x:Name="radScheduler" ViewMode="Day" AvailableViewModes="Day" DayHeaderFormat="{}{0:ddd dd}" IsViewModeNavigationEnabled="False"
                                   HorizontalContentAlignment="Center"
                                   ScrollViewer.VerticalScrollBarVisibility="Auto"
     telerikDragDrop:RadDragAndDropManager.AllowDrop="False"
     AppointmentEditing="radScheduler_AppointmentEditing"
     AppointmentEdited="radScheduler_AppointmentEdited"
     AppointmentDeleting="radScheduler_AppointmentDeleting"
     IsInlineEditingEnabled="False"
     ShowsConfirmationWindowOnDelete="False"
     AppointmentCreating="radScheduler_AppointmentCreating" Width="Auto">
            </telerikScheduler:RadScheduler>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroup2">
          <RadDock:RadPane x:Name="PaneToDoList" RadDock:RadDocking.SerializationTag="PaneToDoList"
                                                            CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="To-Do List" MaxHeight="1000" MaxWidth="1000" MinHeight="0" MinWidth="0" Height="20">
            <mycontorlControls:mycontorlGridView
                                                         x:Name="gvToDoList"
                                                         IsReadOnly="True"
                                                         ScrollMode="RealTime"
                                                         VerticalAlignment="Stretch"
                                                         HorizontalAlignment="Stretch"
                     IsFilteringAllowed="False"
                     ShowGroupPanel="False" Loaded="gvToDoList_Loaded"
                                                         VerticalGridLinesBrush="Gray" RowLoaded="gvToDoList_RowLoaded" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            </mycontorlControls:mycontorlGridView>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroup3">
          <RadDock:RadPane x:Name="PaneOpportunities" RadDock:RadDocking.SerializationTag="PaneOpportunities"
                           CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Opprotunities" Height="20">
            <mycontorlControls:mycontorlGridView
                                                         x:Name="gvOpportunities"
                                                         AutoGenerateColumns="False"
                                                         IsReadOnly="True"
                                                         ScrollMode="RealTime"
                                                         VerticalAlignment="Stretch"
                                                         HorizontalAlignment="Stretch"
                                                         IsFilteringAllowed="False"
                         ShowGroupPanel="False" Loaded="gvOpportunities_Loaded"
                                                         VerticalGridLinesBrush="Gray" RowLoaded="gvOpportunities_RowLoaded" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            </mycontorlControls:mycontorlGridView>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
      </RadDock:RadSplitContainer>
      <RadDock:RadSplitContainer Name="schedulerspliterright" InitialPosition="DockedRight" Orientation="Vertical" MinHeight="0" MaxHeight="1000" MinWidth="0" MaxWidth="1000" RadDock:RadDocking.SerializationTag="schedulerspliterright">
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroupright1">
          <RadDock:RadPane x:Name="PaneMeeting" RadDock:RadDocking.SerializationTag="PaneMeeting"
            CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Meeting" Height="20">
            <mycontorlControls:mycontorlGridView
                                                         x:Name="gvMeeting"
                                                         AutoGenerateColumns="False"
                                                         IsReadOnly="True"
                                                         ScrollMode="RealTime"
                                                         VerticalAlignment="Stretch"
                                                         HorizontalAlignment="Stretch"
                                                         IsFilteringAllowed="False"
                     ShowGroupPanel="False" Loaded="gvMeeting_Loaded"
                                                         VerticalGridLinesBrush="Gray" RowLoaded="gvMeeting_RowLoaded" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            </mycontorlControls:mycontorlGridView>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroupright2">
          <RadDock:RadPane x:Name="PaneCases" RadDock:RadDocking.SerializationTag="PaneCases"
            CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Cases" Height="20">
      
            <mycontorlControls:mycontorlGridView
                                                         x:Name="gvCases"
                                                         AutoGenerateColumns="False"
                                                         IsReadOnly="True"
                                                         ScrollMode="RealTime"
                                                         VerticalAlignment="Stretch"
                                                         HorizontalAlignment="Stretch"
                                                         IsFilteringAllowed="False"
                     ShowGroupPanel="False" Loaded="gvCases_Loaded"
                                                         VerticalGridLinesBrush="Gray" RowLoaded="gvCases_RowLoaded" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            </mycontorlControls:mycontorlGridView>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroupright3">
          <RadDock:RadPane x:Name="PaneCalls" RadDock:RadDocking.SerializationTag="PaneCalls"
            CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Calls" Height="20">
            <mycontorlControls:mycontorlGridView
                                                         x:Name="gvCalls"
                                                         AutoGenerateColumns="False"
                                                         IsReadOnly="True"
                                                         ScrollMode="RealTime"
                                                         VerticalAlignment="Stretch"
                                                         HorizontalAlignment="Stretch"
                                                         IsFilteringAllowed="False"
                     ShowGroupPanel="False" Loaded="gvCalls_Loaded"
                                                         VerticalGridLinesBrush="Gray" RowLoaded="gvCalls_RowLoaded" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto">
            </mycontorlControls:mycontorlGridView>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroupright4">
          <RadDock:RadPane x:Name="PaneGraph" RadDock:RadDocking.SerializationTag="PaneGraph"
            CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Opportunities - Projected Revenue by Stage">
            <telerikChart:RadChart x:Name="radChart" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"/>
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
        <RadDock:RadPaneGroup RadDock:RadDocking.SerializationTag="schedulergroupright5">
          <RadDock:RadPane x:Name="PaneEmail" RadDock:RadDocking.SerializationTag="PaneEmail"
                           CanUserClose="False"
                                                            CanDockInDocumentHost="False"
                                                            CanFloat="True"
                                                            Header="Email" Height="80">
            <mycontorl:SelectEmailControl x:Name="ctlSelectEmail" />
          </RadDock:RadPane>
        </RadDock:RadPaneGroup>
      </RadDock:RadSplitContainer>
    </RadDock:RadDocking>

    My XML File code which store in string layoutxml variable
    <?xml version="1.0" encoding="utf-8"?>
    <RadDocking>
      <SplitContainers>
        <RadSplitContainer SerializationTag="schedulerspliterright" Dock="DockedRight" Orientation="Vertical">
          <Items>
            <RadPaneGroup SerializationTag="schedulergroupright1" SelectedIndex="-1">
              <Items />
            </RadPaneGroup>
            <RadPaneGroup SerializationTag="schedulergroupright2" SelectedIndex="-1">
              <Items />
            </RadPaneGroup>
            <RadPaneGroup SerializationTag="schedulergroupright3" SelectedIndex="-1">
              <Items />
            </RadPaneGroup>
            <RadPaneGroup SerializationTag="schedulergroupright4" SelectedIndex="0">
              <Items>
                <RadPane SerializationTag="PaneGraph" IsDockable="True" Title="Opportunities - Projected Revenue by Stage" Header="Opportunities - Projected Revenue by Stage" CanUserClose="False" CanDockInDocumentHost="False" CanFloat="True" />
              </Items>
            </RadPaneGroup>
            <RadPaneGroup SerializationTag="schedulergroupright5" SelectedIndex="0">
              <Items>
                <RadPane SerializationTag="PaneEmail" IsDockable="True" Title="Email" Header="Email" CanUserClose="False" CanDockInDocumentHost="False" CanFloat="True" />
              </Items>
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
        <RadSplitContainer InitialPosition="FloatingDockable" FloatingWidth="220" FloatingHeight="300" FloatingX="259" FloatingY="221" IsInOpenWindow="True" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
          <Items>
            <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
              <Items>
                <RadPane SerializationTag="PaneMeeting" IsDockable="True" Title="Meeting" Header="Meeting" CanUserClose="False" CanDockInDocumentHost="False" CanFloat="True" />
              </Items>
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
        <RadSplitContainer InitialPosition="FloatingDockable" FloatingWidth="220" FloatingHeight="300" FloatingX="652" FloatingY="306" IsInOpenWindow="True" WindowZIndex="1" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
          <Items>
            <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
              <Items>
                <RadPane SerializationTag="PaneCases" IsDockable="True" Title="Cases" Header="Cases" CanUserClose="False" CanDockInDocumentHost="False" CanFloat="True" />
              </Items>
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
        <RadSplitContainer InitialPosition="FloatingDockable" FloatingWidth="220" FloatingHeight="300" FloatingX="117" FloatingY="129" IsInOpenWindow="True" WindowZIndex="2" RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True">
          <Items>
            <RadPaneGroup RelativeWidth="100" RelativeHeight="100" IsAutoGenerated="True" SelectedIndex="0">
              <Items>
                <RadPane SerializationTag="PaneCalls" IsDockable="True" Title="Calls" Header="Calls" CanUserClose="False" CanDockInDocumentHost="False" CanFloat="True" />
              </Items>
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
      </SplitContainers>
    </RadDocking>


    I try to save layout it is perfectly working with XML file and also get the file. But when I try to LoadLayout it gives me error.

    i also try to set Serelization

    RadDock

    :RadDocking.SerializationTag="schedulergroup1"  

     in to all

    RadPaneGroup

    with different name or same name to all tag and remove the serializatin.
    but it gives me same error.

    Please, help me to resolved this issue.

    Thanks,
    Gaurang
  5. Gaurang
    Gaurang avatar
    29 posts
    Member since:
    Dec 2010

    Posted 09 Aug 2011 Link to this post

    Hi,
    I used below code for Load layout and it is working.

    using (MemoryStream storage = new MemoryStream(Encoding.UTF8.GetBytes(layoutxml)))
                {
                    this.DockingControl.LoadLayout(storage);
                }

    I also change in my XAML file.

    I removed serialization from RadPaneGroup, RadSplitContainer.

    Thanks,
    Gaurang
Back to Top