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

In RadPanelBar CloseButton

3 Answers 64 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 23 May 2011, 09:03 AM
Hi,
I have Created RadPanelBar at runtime but i want to add close button in the RadPanelBar near Header.

3 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 26 May 2011, 09:30 AM
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
0
Amit
Top achievements
Rank 1
answered on 26 May 2011, 12:16 PM
Thanks for Sending  Code For RadPanel  Close Button
Question is that .How Can I Close the RadPanelBar Using CloseButton
0
Petar Mladenov
Telerik team
answered on 31 May 2011, 01:50 PM
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
Tags
PanelBar
Asked by
Amit
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Amit
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or