RadPane ElementLoaded doesn't reflect changes in AffectedElement

2 posts, 0 answers
  1. Radiation
    Radiation avatar
    13 posts
    Member since:
    Jul 2012

    Posted 25 Oct 2012 Link to this post

    Hi,

    I have following code, which should hide unknown elements when deserializing layout xml
    private void dockManager_ElementLoaded(object sender, LayoutSerializationEventArgs e)
     {
       if (e.AffectedElement is RadPane)
       {
         RadPane paneView = e.AffectedElement as RadPane;
     
     
         ILayoutPane paneVM = viewModel.LayoutPanes
           .OfType<ILayoutPane>()
           .FirstOrDefault(vm => vm.Id == e.AffectedElementSerializationTag);
     
         if (paneVM == null)
         {
           paneView.IsHidden = true;
         }
       }
     }


    Althought   paneView.IsHidden = true   is called, the pane is still visible after the LoadLayout.
    I tried to set title of the paneView.Title as well. Title was not displayed.

    Layout file look like this:

    <RadDocking>
      <DocumentHost>
        <RadSplitContainer>
          <Items>
            <RadPaneGroup SelectedIndex="0">
              <Items>
                <RadPane IsHidden="False" IsDockable="True" />
              </Items>
            </RadPaneGroup>
          </Items>
        </RadSplitContainer>
      </DocumentHost>
    </RadDocking>



    And another question, or request:
    How can I prevent element from being serialized or deserialized? ElementLoading and ElementSaving should have  cancelable EventArgs.

    private void dockManager_ElementLoading(object sender, LayoutSerializationLoadingEventArgs e)
    {
      if (e.AffectedElementSerializationTag == null) e.Cancel = true;
    }


     
    Thanks
  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 30 Oct 2012 Link to this post

    Hello Andrej,

    Thank you for contacting us.

    It is not recommended to filter the xml when you are loading it in the Docking control, it is a better practice to edit the generated MemoryStream just after you call the SaveLayout() method when you are saving the layout.

    This could be done by using the XDocument class and remove all the RadPanes that don't have a SerializationTag. That way when you load the layout you wont need to worry about filtering it from RadPanes without SerializationTag.

    About your second questions, we have logged a feature requests in our Public Issue Tracker System about that exact scenario and you can find it here. We will do our best to have this feature available in our next Q3 2012 SP release of RadControls.

    Hope this helps, if you have any other questions feel free to write to us again.

    Regards,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top