Saving contents of RadPane

2 posts, 0 answers
  1. Mike5
    Mike5 avatar
    7 posts
    Member since:
    Nov 2011

    Posted 31 Jan 2012 Link to this post

    My WPF application permits users to select from a collection of <UserControl/> at runtime.
    Each <UserControl/> is loaded as content to a RadPane. Each RadPane, RadPaneGroup
    and RadSplitContainer has a unique serialization tag:


    internal void UserControlToRADPane(UserControl theControl, string theName)
    {
        RadSplitContainer leftContainer = new RadSplitContainer() { InitialPosition = DockState.DockedLeft };
        RadPaneGroup group = new RadPaneGroup() { Name = "RPG" + (++_radPaneGroupId).ToString() };
        RadPane aPane = new RadPane() { Header = theName, Content = theControl };
     
        RadDocking.SetSerializationTag(leftContainer, "rsp_" + leftContainer.Name + "_tag" + (++_aStaticIntValue).ToString());
        RadDocking.SetSerializationTag(group, "rpg_" + group.Name + "_tag" + (++_aStaticIntValue).ToString());
        RadDocking.SetSerializationTag(aPane, "rp_" + aPane.Header + "_tag" + (++_aStaticIntValue).ToString());
     
        group.AddItem(aPane, DockPosition.Center);
        leftContainer.Items.Add(group);
        MainDockingManager01.Items.Add(leftContainer);
    }


    I have created an event handler for ElementSaving.  At the point we are saving a RadPane, I
    want to serialize the contents (which is a user-selected <UserControl/> as above):


    private void dockingManager01_ElementSaving(object sender, LayoutSerializationEventArgs args)
    {
        // Since we are accessing UI elements, we need ownership and
        // the quickest way to get that is to run on the STA thread.
     
        if (args.AffectedElement.GetType() == typeof(Telerik.Windows.Controls.RadPane))
        {
            var uc = ((RadPane)args.AffectedElement).Content as UserControl;
            ViewModel.VMDockingManager01.Instance.ElementSaving(sender, args, uc);
        }
        else
            ViewModel.VMDockingManager01.Instance.ElementSaving(sender, args);
    }

    My first question: Am I on the right track with this approach, or has Telerik implemented
    some functionality that would permit a cleaner approach?   I note a reference to a method
    called GetPaneContent() at this link in the Silverlight forum.  Is that a reference to some
    user-created method... or is it a method provided by Telerik?




  2. George
    Admin
    George avatar
    1332 posts

    Posted 03 Feb 2012 Link to this post

    Hello Mike,


    You are on the right approach. The GetPaneContent() method is a user-defined method and its implementation is different in all scenarios and this is the reason why its body is not included in our documentation.


    Please, do not hesitate to contact us if you have further questions.

     

    Kind regards,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

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