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

icon for panel header / panel tab

13 Answers 271 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 2
Jonathan asked on 01 Jun 2009, 10:26 PM
is it possible / how do I add an icon for a RadPane, to show up in the header next to the header title, and to show up in the tab when the pane is unpinned and collapsed?

thanks in advance

/jonathan

13 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 2
answered on 03 Jun 2009, 04:36 PM
telerik?

is it possible to attach an icon to the title of a pane?

/jonathan
0
Miroslav Nedyalkov
Telerik team
answered on 04 Jun 2009, 08:00 PM
Hi Jonathan,

Yes you can show Icon on Pane's header. You need to use the Header and HeaderTemplate properties of the Pane. The attached example demonstrates two approaches of doing that.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
iven
Top achievements
Rank 1
answered on 13 Jul 2009, 10:12 AM
Hi Telerik,

Both methods of the sample code are not work for panels in DocumentHost, is there any way to work for it?
I attached my code as following, please give me some suggestions, many thanks.

Method 1:
               ... 
               <dock:RadDocking.DocumentHost> 
                <dock:RadSplitContainer> 
                    <dock:RadPaneGroup TabStripPlacement="Bottom"    > 
                        <dock:RadPane> 
                           <dock:RadPane.Header> 
                                <StackPanel Orientation="Horizontal"
                                    <Image Source="Icon.jpg" Width="16" Height="16" /> 
                                    <TextBlock Text="ViewPane" /> 
                                </StackPanel> 
                           </dock:RadPane.Header> 
                        </dock:RadPane> 
                    </dock:RadPaneGroup> 
                </dock:RadSplitContainer> 
            </dock:RadDocking.DocumentHost> 

The panel header does not display the content of the StackPanel, its display is "System.Windows.Controls.StackPanel", I'm very confused.

Method 2:
in the XAML:

          .... 
          <dock:RadDocking.DocumentHost> 
                <dock:RadSplitContainer> 
                    <dock:RadPaneGroup  x:Name="ViewTab"  > 
                        <dock:RadPane> 
                            <dock:RadPane.HeaderTemplate> 
                                <DataTemplate> 
                                    <StackPanel Orientation="Horizontal"
                                        <TextBlock Text="{Binding ViewCaption}" /> 
                                    </StackPanel> 
                                </DataTemplate> 
                            </dock:RadPane.HeaderTemplate> 
                        </dock:RadPane> 
                    </dock:RadPaneGroup> 
                </dock:RadSplitContainer> 
            </dock:RadDocking.DocumentHost> 
            ... 

and in the code behind of C#:

         RadPane viewPane = ViewTab.Items[0] as RadPane; 
         viewPane.DataContext=viewData; 

viewData is one instance of inner class ViewData which inludes a public property ViewCaption, somehow, the viewPane does not show the viewData.ViewCaption as expected, it just display the header text as blank, actually viewData.ViewCaption has a specified value "ViewPane". what's wrong?

Any suggestions,  many thanks.

0
iven
Top achievements
Rank 1
answered on 14 Jul 2009, 04:47 PM
Telerik?

Any suggestion for the issue I reported?
0
Kaloyan
Telerik team
answered on 15 Jul 2009, 12:50 PM
Hi iven,

You can set a custom header template following this code snippet:
  <telerikDocking:RadDocking.DocumentHost> 
                <telerikDocking:RadSplitContainer> 
                    <telerikDocking:RadPaneGroup TabStripPlacement="Bottom"
                        <telerikDocking:RadPane> 
                            <telerikDocking:RadPane.HeaderTemplate> 
                                <DataTemplate> 
                                    <StackPanel Orientation="Horizontal"
                                        <Image Source="Icon.jpg" Width="16" Height="16" /> 
                                        <TextBlock Text="ViewPane" /> 
                                    </StackPanel> 
                                </DataTemplate> 
                            </telerikDocking:RadPane.HeaderTemplate> 
                        </telerikDocking:RadPane> 
                    </telerikDocking:RadPaneGroup> 
                </telerikDocking:RadSplitContainer> 
            </telerikDocking:RadDocking.DocumentHost> 

Also your object has to implement the INotifyPropertyChanged interface in order to bind it to the Header property of the RadPane control.



Greetings,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
iven
Top achievements
Rank 1
answered on 15 Jul 2009, 01:20 PM
Hi Kaloyan,

Thanks for your reply.

But in the HeaderTemplate you suggested, the text of the TextBlock is fixed, I want to change the text at runtime, meanwhile, I want the header includes icon, and close button, however, in the HeaderTemplate, binding the text of TextBlock does not work, it just displays blank, so any suggestions?

thanks.
0
Kaloyan
Telerik team
answered on 16 Jul 2009, 11:06 AM
Hello iven,

Currently, there is a bug appearing when trying to set the binding to the Header or Title of the RadPane. We are working to eliminate this limitation end will provide you with a working version for one of the upcoming releases. Attached you can find an application showing a workaround application. Hope this will help you.

Greetings,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
iven
Top achievements
Rank 1
answered on 16 Jul 2009, 03:48 PM
Hi Kaloyan,

It is weird, but works fine. thanks a lot.
0
Robert Pelzer
Top achievements
Rank 2
answered on 07 Oct 2009, 10:11 PM
Has the binding bug to the header of a pane been corrected with the latest release as of 10/7/2009?

I am wanting to update the header of the rad pane with the name of the user once they've logged in.
0
Miroslav Nedyalkov
Telerik team
answered on 08 Oct 2009, 12:24 PM
Hi Ryan,

You could download the latest internal build version from this week (that should be released by the end of tomorrow) as we have some more fixes included.

Best wishes,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Nathan J Pledger
Top achievements
Rank 2
answered on 05 Nov 2009, 11:00 AM
Hi,

I ahve just installed Q3 2009 controls and what was working is now leaving "System.Windows.Controls.StackPanel" in the heder instead of the icon and text. Here is my code:

        private static void SetPaneHeader(IViewPane viewPane, RadPane pane) 
        { 
            if (string.IsNullOrEmpty(viewPane.ImageResourceUrl)) 
            { 
                //pane.Header = viewPane.PaneTitle; 
                pane.Title = viewPane.PaneTitle; 
            }  
            else 
            { 
                StackPanel stackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; 
                Image image = new Image() 
                    { 
                        Source=(ImageSource)new ImageSourceConverter().ConvertFromString(viewPane.ImageResourceUrl) 
                    }; 
                stackPanel.Children.Add(image); 
                TextBlock textBlock = new TextBlock() { Text = viewPane.PaneTitle, Margin = new Thickness(3, 0, 0, 0) }; 
                stackPanel.Children.Add(textBlock); 
                pane.Header = stackPanel; 
                //pane.Title = viewPane.PaneTitle; 
            } 
        } 


Am I doing something wrong for the Q3 release?

I've attached an image to show what I mean. The top tab does not have an icon, so just displays text, the bottom one does, so should render a StackPanel?

Thanks

0
Nathan J Pledger
Top achievements
Rank 2
answered on 05 Nov 2009, 11:25 AM
Hi,

Actually, cancel that. I realised I need to manually reinstate the StackPanel on deserialisation of the pane. So is fixed, now.

Also, the Docking control is not on the Silverlight Controls slide on the following page on your web-site:


0
Nikolay
Telerik team
answered on 10 Nov 2009, 04:38 PM
Hi Nathan J Pledger,

Thanks for your note. We will add the respective support page for RadDocking.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Docking
Asked by
Jonathan
Top achievements
Rank 2
Answers by
Jonathan
Top achievements
Rank 2
Miroslav Nedyalkov
Telerik team
iven
Top achievements
Rank 1
Kaloyan
Telerik team
Robert Pelzer
Top achievements
Rank 2
Nathan J Pledger
Top achievements
Rank 2
Nikolay
Telerik team
Share this question
or