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

Rename Tab Item header

1 Answer 91 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
runes
Top achievements
Rank 1
runes asked on 05 Apr 2009, 09:25 AM
Hi,
I'd like to create a tab control in which the header is editable - the user will be able to change the header (like in Exel).
I tried to do it, but it was not work:
I define tab item with header (Header="My Tab" ),on double-click the headre content replaced with a TextBox.(Then give focus to the textBox and SelectAll()...)
but the text box value was always null.
When I put initially TextBox in the header, it was work!
my code:

 

 

<telerikNavigation:RadTabControl x:Name="rashi" AllowDragReorder="True" AllowDragOverTab="True" >

 

 

 

<telerikNavigation:RadTabItem x:Name="tab1" Header="My Tab" MouseLeftButtonUp="tab1_MouseLeftButtonUp"></telerikNavigation:RadTabItem>

 

 
cs: 

 

private void tab1_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)

 

{

 

 

 

RadTabItem

 

t = new RadTabItem();

 

t = rashi.SelectedItem

as RadTabItem;

 

 

TextBox tx = new TextBox();

 

tx = t.Header

as TextBox;

 

tx.Focus();

tx.SelectAll();

tx.Background =

new SolidColorBrush(Colors.Transparent);

 

tx.BorderThickness =

new Thickness(0);

 

 

 

 

}

Can you help me? Why this does not work? Maybe you have other idea?
Thanks

 

1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 07 Apr 2009, 06:53 AM
Hello runes,

There is a thread here where we discuss an implementation of this same thing (using an EditableContentControl):

http://www.telerik.com/community/forums/silverlight/tabcontrol/editable-tab-header.aspx

Please note that with thee Q1 release we missed out a TemplateBinding so Binding may not work in certain cases. You can find a project with working ControlTemplate here:

http://www.telerik.com/community/forums/silverlight/tabcontrol/setting-radtabitem-headertemplate-in-code-with-resource.aspx

(This will be fixed for the SP)

Sincerely yours,
Miroslav
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
TabControl
Asked by
runes
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or