How to set the RadPane Background Programmatically

2 posts, 0 answers
  1. Scott
    Scott avatar
    5 posts
    Member since:
    Jun 2006

    Posted 11 Jul 2010 Link to this post

    Hello,

    I think this is a simple one, but still having problems. I am creating the RadPane, and RadPaneGroup objects dynamically, and adding them to the XAML defined RadDocking and RadSplitter controls. My RadPane appears, but I can't seem to get the background to set.

    I'm certainly missing something obvious but its is eluding me at present.

               var brush = new SolidColorBrush() { Color = Colors.Purple };

                RadPane pane = new RadPane();
                pane.CanFloat = true;
                pane.Header = "Software";
                pane.MakeFloatingDockable();
                pane.Background = brush;

                var DashboardPaneGroup= new RadPaneGroup();
                DashboardSplit.Items.Add(DashboardPaneGroup);
                DashboardPaneGroup.Items.Add(pane);

    Also, how could I specify the starting position of the dynamically added panes? I was doing it like this:

    DashboardPaneGroup.AddItem(pane1, DockPosition.Left);

    But read a post indicating that was not correct.

    Thanks for your help,

    Scott
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 13 Jul 2010 Link to this post

    Hello Scott,

     If you want to set the background of the content of the Pane you should set the background of its root element. The background of the Pane is used for the TabItem. You could use the following code:

    <telerik:RadPane>
     <Grid Background="Red">
     ...
     </Grid>
    </telerik:RadPane>

    In the code-behind you could find the Content first and set its Background.

    Panes are added in the Items collection of the groups and if you want to insert a Pane you just need to insert it in the Items collection of the group in the index you wish. The AddItem method is used by the Drag&drop of panes to position a pane relatively to a group.

    All the best,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top