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

SpaceKey issue with TextBox in ExpanderHeader

3 Answers 58 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Licenses
Top achievements
Rank 1
Licenses asked on 18 Aug 2010, 04:05 PM
Hello,

I have a RadExpander with in its header a textbox. When I try to type a " " (space) inside the textbox, the expander collapses/expands. I've searched for solutions but the only one I can find is to change the template according to this post (http://www.telerik.com/community/forums/silverlight/expander/preventing-expander-to-expand-on-space-key.aspx). Unfortunately I'm unable to find the ToggleButton in the template. Maybe this is because this is a rather old post?

I've also tried to play with the keydown/up events, but this doesn't seem to do the trick. Could someone give me any ideas? I'm not that good in changing templates, so an example would be nice.

Thanks,
We Sodi

3 Answers, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 20 Aug 2010, 08:52 AM
Hi Sodi We,

Attached is a sample project where I edited the style in Blend, shrunk the header of the RadExpander and added a TextBox instead. Could you please review it and if you have questions feel free to ask?

On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverlight applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx

Sincerely yours,
Viktor Tsvetkov
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
Licenses
Top achievements
Rank 1
answered on 20 Aug 2010, 09:25 AM
I can see that you've added the TextBox to the ExpanderTemplate, but I think this isn't the right approach for me.

I'll explain my situation in more detail. I have an ItemsControl that is bound to an observable collection of steps. For every step, I show a radexpander with in its header a textbox with the name of the step. Every step contains one or more tasks. So, in the radexpandercontent for the steps, there is another itemscontrol for the tasks. For every task a radexpander is shown, with in its header a textbox with the name of the task. Users can edit this name. Next to the name textbox for the step there are four buttons: add task, remove step, and move step up or down. Next to the name textbox for the task there is one button: remove task.

In the sample application you've provided, there is a "hardcoded" textbox in the style. I'm not sure on how to bind the stepname to the text property of this textbox? Do I have to inherit from the RadExpander and add an extra DependencyProperty for the name? And if I want the buttons to be displayed as well, then I would have to have an extra "container" somewhere in the Style as well, and the dependency property in the inherited class? For me it would be enough if there was just a way to disable the spacekey for the radexpanderheader...

This seems like a lot of work, and I'm not familiar with the best approach on how to extend Telerik Controls this way. So any help is much appreciated.

Thanks,
Sodi We
0
Viktor Tsvetkov
Telerik team
answered on 20 Aug 2010, 11:44 AM
Hi Sodi We,

As soon as you have to bind the TextBox, you can set  Text="{TemplateBinding Tag}" and in the RadExpander to bind Tag="{Binding Name}". About the buttons next to the TextBox you can just organize your layout to look like that instead of adding them in the style of the RadExpander.

Regards,
Viktor Tsvetkov
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
Expander
Asked by
Licenses
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Licenses
Top achievements
Rank 1
Share this question
or