In RadPanelBar CloseButton

4 posts, 0 answers
  1. Amit
    Amit avatar
    2 posts
    Member since:
    May 2011

    Posted 23 May 2011 Link to this post

    Hi,
    I have Created RadPanelBar at runtime but i want to add close button in the RadPanelBar near Header.
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 26 May 2011 Link to this post

    Hello Amit,

    Are you binding RadPanelBar or you're populating it with RadPanelBarItem's on the fly, as shown bellow:

    public MainPage()
    {
        InitializeComponent();
     
        RadPanelBar panelBar = new RadPanelBar();
        RadPanelBarItem panelBarItem = new RadPanelBarItem();
        StackPanel stackPanel = new StackPanel();
        stackPanel.Orientation = Orientation.Horizontal;
        TextBlock header = new TextBlock();
        header.Text = "Header";
        header.VerticalAlignment = System.Windows.VerticalAlignment.Center;
        header.Margin = new Thickness(10, 0, 10, 0);
        Button closeButton = new Button();
        closeButton.Content = "CLOSE";
        closeButton.Click += new RoutedEventHandler(CloseButton_Click);
        stackPanel.Children.Add(header);
        stackPanel.Children.Add(closeButton);
        panelBarItem.Header = stackPanel;
        panelBar.Items.Add(panelBarItem);
        this.LayoutRoot.Children.Add(panelBar);
    }
     
    private void CloseButton_Click(object sender, RoutedEventArgs e)
    {
        MessageBox.Show("Close Button Clicked");
    }

    The outcome from the above is the following:


    If the above does not help, could you please share more details about your scenario and the way you populate RadPanelBar.

    Greetings,
    Kiril Stanoev
    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
  4. Amit
    Amit avatar
    2 posts
    Member since:
    May 2011

    Posted 26 May 2011 Link to this post

    Thanks for Sending  Code For RadPanel  Close Button
    Question is that .How Can I Close the RadPanelBar Using CloseButton
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 31 May 2011 Link to this post

    Hi Amit,

    You can use the telerik`s generic extension method ParentOfType<> in order to detect the parent RadPanelBarItem ( the container) of the clicked button. Then just remove the container from the items collection of the PanelBar. You can examine this realized in the attached solution.

    Kind regards,
    Petar Mladenov
    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
Back to Top