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


    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
           .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:

            <RadPaneGroup SelectedIndex="0">
                <RadPane IsHidden="False" IsDockable="True" />

    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;

  2. Vladi
    Vladi avatar
    749 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.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top