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

Styling a radpane

2 Answers 46 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Zamel
Top achievements
Rank 1
Zamel asked on 14 Nov 2012, 08:38 AM
Hi,

I was trying to implement a custom style in our radpanes but without success. These radpanes are created dynamically and we are using Windows 7 as the theme.

I found this one: Styling the RadPane Header from the forum but when I used the same style, there was no effect on my radpanes. I've also tried to just simply set the radpane's background color to something else but I still cannot see any changes.

This is what our radpanes look like:



What I'm trying to achieve is that I only want to color the radpane header when selected, change the background to blue and the text to white. I've already tried different ways to fix this but cannot see any effect!!  Why? :(

I'm pasting the xaml code as well so you can check if there's anything wrong with it.

<Border Grid.Row="2"
                Style="{StaticResource ContentBorderStyle}">
            <telerik:RadDocking x:Name="radDocking"
                                Background="Transparent">
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer x:Name="radSplitContainer"
                                               InitialPosition="FloatingDockable">
                        <telerik:RadPaneGroup x:Name="radCenterPaneGroup"
                                              BorderBrush="Transparent"
                                              BorderThickness="0">
                            <telerik:RadPane CanUserClose="False"
                                             Visibility="Collapsed"
                                             CanFloat="False">
                                <navigation:Frame x:Name="ContentFrame"
                                                  Style="{StaticResource ContentFrameStyle}" />
                            </telerik:RadPane>
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
            </telerik:RadDocking>
        </Border>

Also, the code behind how we create the radpanes dynamically:

var window = AppBase.Current.NavigationWindows
                    .FirstOrDefault(w => w.NavigationCode == menuItem.NavigationCode);
                if (window != null)
                {
                    var windowInfo = (this.Windows ?? Enumerable.Empty<PcsysFxWindow>())
                        .FirstOrDefault(w => w.NavigationCode == menuItem.NavigationCode);
                    if (windowInfo != null && windowInfo.IsSingleInstance)
                    {
                        var existingPane = this.radDocking.Panes
                            .FirstOrDefault(s => s.DataContext == windowInfo);
                        if (existingPane != null)
                        {
                            existingPane.IsHidden = false;
                            existingPane.IsSelected = true;
                            return;
                        }
                    }
 
                    var paneGroup = ResolvePaneGroup(windowInfo);
                    var pane = new RadPane();
 
                    pane.Content = window.CreateWindowContent();
                    if (windowInfo != null)
                    {
                        pane.DataContext = windowInfo;
                        pane.Header = LocalizationManager.GetString(windowInfo.Header);
                        if (windowInfo.InitialPosition < 0)
                        {
                            paneGroup.AddItem(pane, Telerik.Windows.Controls.Docking.DockPosition.Top);
                            pane.MakeFloatingDockable();
                        }
                        else
                        {
                            if (paneGroup.Items.Count() > 0)
                            {
                                paneGroup.Items.Add(pane);
                            }
                            else
                            {
                                paneGroup.AddItem(pane, (Telerik.Windows.Controls.Docking.DockPosition)windowInfo.InitialPosition);
                            }
                        }
                    }
                    else
                    {
                        paneGroup.AddItem(pane, Telerik.Windows.Controls.Docking.DockPosition.Center);
                    }
 
                    return;

I'm quite a newbie to silverlight, please help me.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Zamel
Top achievements
Rank 1
answered on 14 Nov 2012, 12:30 PM
Hi again,

It seems that the style is overriden by the default theme. I found this line of code:
StyleManager.ApplicationTheme = new Windows7Theme();

When I tried to comment that out, then I see the effect of my custom style. Is there any way how can I use my style instead of the defined one?? Please.

Thanks!
0
Accepted
Masha
Telerik team
answered on 19 Nov 2012, 09:52 AM
Hello Zamel,

We recommend using Implicit Styles in the project. This way you can easily apply modifications on RadPane, based on the default style. You can read more about implicit styles in our online documentation.

Another solution is to copy RadDocking Style for Windows7 Theme in App.xaml and apply modifications there. You can get the style for RadDocking for Windows7 theme from your RadControls installation folder. You will find there a Themes folder, which contains resources for all themes.

Hope this helps.

Kind regards,
Maria
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Docking
Asked by
Zamel
Top achievements
Rank 1
Answers by
Zamel
Top achievements
Rank 1
Masha
Telerik team
Share this question
or