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

Adding a close button in header of Radpane (Urgent)

2 Answers 135 Views
Docking
This is a migrated thread and some comments may be shown as answers.
jusin
Top achievements
Rank 1
jusin asked on 21 Jul 2011, 08:46 PM
Hello!

I added a close button in header of Radpane by creating a usercontrol.This worked fine in the prev versions(2011.1.419.1040),but after I upgrade my sln to telerik q2 2011,  exceptions come out everytime when clicking the close button.  I am wondering whether it is a bug or Radpane's properties have been changed in q2 2011 release ? Thx in advance!

sample code is like the following.

--TabHeader.xaml

<UserControl x:Class="test.TabHeader"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
d:DesignHeight="22" d:DesignWidth="400">

<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="80"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>

<TextBlock x:Name="tbHeader" Grid.Column="0" />
<telerik:RadButton Grid.Column="1" x:Name="btnClose" Width="16" Height="16" Content="x" Background="Transparent" ToolTipService.ToolTip="close"
FontWeight="Medium" BorderThickness="0" Margin="1" Padding="0" VerticalAlignment="Center" HorizontalAlignment="Center" Click="btnClose_Click" />

</Grid>
</UserControl>

---TabHeader.cs----------

namespace test.UserCtrl
{
    public partial class TabHeader : UserControl
    {
        private RadPane currentPane;
        public TabHeader(RadPane pane, string header)
        {
            InitializeComponent();

            this.tbHeader.Text = header;
            this.currentPane = pane;
        }

      

        private void btnClose_Click(object sender, RoutedEventArgs e)
        {

            ItemCollection items = (this.currentPane.Parent as RadPaneGroup).Items;
            this.currentPane.IsHidden = true;
            (items[items.Count - 1] as RadPane).IsSelected = true;        }
    }
}

2 Answers, 1 is accepted

Sort by
0
jusin
Top achievements
Rank 1
answered on 22 Jul 2011, 09:03 AM
anybody can help... thanks a lot!

don't know why same code worked fine with  Q1 2011, but met EXCEPTION after updating to Q2 2011 !!
0
jusin
Top achievements
Rank 1
answered on 26 Jul 2011, 12:51 PM
Solved after I check api documents. Thank you, I will request my firm to buy a license further!
Tags
Docking
Asked by
jusin
Top achievements
Rank 1
Answers by
jusin
Top achievements
Rank 1
Share this question
or