RadLayoutControl Save/Load not working

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    2 posts
    Member since:
    Jul 2017

    Posted 01 Aug Link to this post

    Hello,

     

    I'm using Telerik 2016.3.1024.45

    I figure out how to save the layout with your documentation and I have now the xml of the layout

    But when I tried to use LoadFromXmlString with the xml it did nothing and the layout stays empty

     

    So I thought that my xml wasn't good and I took the one from your example and it didn't work either.

     

    Here the xml I tried to load (it's your sample)

    <?xml version="1.0" encoding="utf-8"?>
    <RadLayoutControl Type="Telerik.Windows.Controls.RadLayoutControl" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SerializationId="myLayoutControlID" Orientation="Horizontal" IsAutoGenerated="false" IsInEditMode="false">
      <Items>
        <Button Type="System.Windows.Controls.Button" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SerializationId="buttonID_1" />
        <Border Type="System.Windows.Controls.Border" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SerializationId="buttonID_2" />
        <LayoutControlGroup Type="Telerik.Windows.Controls.LayoutControlGroup" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SerializationId="layoutGroup_1" Orientation="Vertical" IsAutoGenerated="false">
          <Items>
            <TextBlock Type="System.Windows.Controls.TextBlock" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" SerializationId="txtBlock_1" />
            <LayoutControlGroup Type="Telerik.Windows.Controls.LayoutControlGroup" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" SerializationId="layoutGroup_2" Orientation="Vertical" IsAutoGenerated="false">
              <Items>
                <TextBlock Type="System.Windows.Controls.TextBlock" Width="NaN" Height="NaN" MinWidth="0" MinHeight="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SerializationId="txtBlock_2" />
              </Items>
            </LayoutControlGroup>
          </Items>
        </LayoutControlGroup>
      </Items>
    </RadLayoutControl>

     

    And I use this to load the xml :

    LayoutControl.LoadFromXmlString(@"<xml_here>");

     

    Can you help me please ?

     

    Thank You

    Hervouet Thomas

  2. Thomas
    Thomas avatar
    2 posts
    Member since:
    Jul 2017

    Posted 01 Aug in reply to Thomas Link to this post

    Hello,

    I understand my problem

    I was using a generated GUID to use as SerializationId for both subelement and the LayoutControl

    But when we load the xml the layoutcontrol loading the data need to have the same Id as in the xml or it will not find it

     

    Thank you, it's working now

    Hervouet Thomas

Back to Top