icon for panel header / panel tab

14 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    15 posts
    Member since:
    Jul 2012

    Posted 01 Jun 2009 Link to this post

    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
  2. Jonathan
    Jonathan avatar
    15 posts
    Member since:
    Jul 2012

    Posted 03 Jun 2009 Link to this post

    telerik?

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

    /jonathan
  3. DevCraft banner
  4. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 04 Jun 2009 Link to this post

    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.
  5. iven
    iven avatar
    6 posts
    Member since:
    May 2009

    Posted 13 Jul 2009 Link to this post

    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.

  6. iven
    iven avatar
    6 posts
    Member since:
    May 2009

    Posted 14 Jul 2009 Link to this post

    Telerik?

    Any suggestion for the issue I reported?
  7. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 15 Jul 2009 Link to this post

    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.
  8. iven
    iven avatar
    6 posts
    Member since:
    May 2009

    Posted 15 Jul 2009 Link to this post

    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.
  9. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 16 Jul 2009 Link to this post

    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.
  10. iven
    iven avatar
    6 posts
    Member since:
    May 2009

    Posted 16 Jul 2009 Link to this post

    Hi Kaloyan,

    It is weird, but works fine. thanks a lot.
  11. Robert Pelzer
    Robert Pelzer avatar
    15 posts
    Member since:
    Aug 2009

    Posted 07 Oct 2009 Link to this post

    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.
  12. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 08 Oct 2009 Link to this post

    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.
  13. Nathan J Pledger
    Nathan J Pledger avatar
    95 posts
    Member since:
    Apr 2006

    Posted 05 Nov 2009 Link to this post

    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

  14. Nathan J Pledger
    Nathan J Pledger avatar
    95 posts
    Member since:
    Apr 2006

    Posted 05 Nov 2009 Link to this post

    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:


  15. Nikolay
    Admin
    Nikolay avatar
    3997 posts

    Posted 10 Nov 2009 Link to this post

    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.
Back to Top
DevCraft banner