This is a migrated thread and some comments may be shown as answers.

RadPane ElementLoaded doesn't reflect changes in AffectedElement

1 Answer 81 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Radiation
Top achievements
Rank 1
Radiation asked on 25 Oct 2012, 03:56 PM
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

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 30 Oct 2012, 01:08 PM
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.

Tags
Docking
Asked by
Radiation
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or