Search code examples
c#silverlightxamltelerikcode-behind

Setting the PaneGroup of a RadPane in the codebehind?


I had created a pane group with rad panes in my XAML as follows :

       <telerik:RadSplitContainer InitialPosition="DockedBottom" telerik:RadDocking.SerializationTag="RaddySplit">
              <telerik:RadPaneGroup telerik:RadDocking.SerializationTag="PaneGroup">
                 <telerik:RadPane Header="WW2 Adventure" telerik:RadDocking.SerializationTag="WW2">
                        <vws:ww2gamegrid  />
                 </telerik:RadPane>
                <telerik:RadPane Header="WW1 Adventure" telerik:RadDocking.SerializationTag="WW1">
                           <vws:ww1gamegrid  />
                </telerik:RadPane>
             </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>

This has a problem however, there is a bug in the telerik RadDocking Serialization, such that when you deploy a site with an additional tab, the number of tabs is maintained in the client's browsers isolated storage.

So, when I try and deploy my new Silverlight page, with "WW3gamegrid" added in (another RadPane) the user is still returned the same code as above.

Having googled this a bit, it seems as if adding this in the code behind could solve my problem. With that in mind, how can I add a RadPane to this RadPaneGroup in my .xaml.cs code behind?

Any other solutions to the problem would of course, be gladly listened to :)

Thanks very much.

The code I have in the code behind is stolen from another website, and not fully implemented as I don't understand it. I have put it in the constructor for the xaml.cs file

:

InitializeComponent();

 RadPane pane = new RadPane();
 pane.Title = "Pane2";
 pane.Header = "Pane2";
 pane.CanUserClose = false;
 pane.CanDockInDocumentHost = false;
 pane.Content = new Button() { Content = "button2" };
 pane.Tag = "tag";
 pane.PaneGroup();
 RadDocking.SetSerializationTag(pane, "abc"); 

How can I make this equivalent to my xaml above, essentially?


Solution

  • To add a RadPane to a RadPaneGroup just use the AddItem method (see Telerik documentation).

    RadPaneGroup paneGroup = new RadPaneGroup();
    
    RadPane pane = new RadPane();
    pane.Header = "WW1 Adventure";
    pane.Content = new ww1gamegrid();
    paneGroup.AddItem(pane, Telerik.Windows.Controls.Docking.DockPosition.Center);