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

Data Template

3 Answers 31 Views
ExpanderControl
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gilbert
Top achievements
Rank 1
Gilbert asked on 13 Mar 2014, 05:08 PM
I have two questions.

1. Is there a way to have an item close the expanded grid when another item expands? In other words, I only want one item to expand when a user taps on it and have another item close if expanded.

2. I have two grids, one on top of another. I would like to have the top grid use the tap event to guide the user to another XAML page, while the bottom grid open the expanded content. This, of course is the Data Template to a DataBound ListBox. I tried moving things around the datatemplate without any success. How can this be accomplished?

thanks, for your feedback.

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 14 Mar 2014, 03:22 PM
Hi Gilberto,

Thanks for writing.

1. You will need to implement the logic that closes the previously opened expander on your side. It's quite simple - you need to subscribe for the ExpanderStateChanged event within your DataBoundListBox' control template and save a reference to the business object which has been expanded. You can acquire it from the sender argument within the event handler which is of type RadExpanderControl. The Content property of the expander will point to the item from your source. Each time this event comes, you will need to first check if there is already an expanded item, set its IsExpanded property to false and store the newly expanded item on its place.

2. I am not quite sure if I correctly understand the scenario here. Any further details will be helpful. You can also share some code if you think it might be helpful.

Thanks for your time.

Regards,
Deyan
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Gilbert
Top achievements
Rank 1
answered on 15 Mar 2014, 07:44 PM
I will post some code when I get home. Thanks for the reply. Your answer to my first question makes sense.

Let me explain my second question.
I have a collection of items on my main page. The ExpanderControl ContentTemplate  has three grid rows.The top grid has a Textblock with the name of the item. The second grid has a textblock with brief details of the item and the third grid is the expandable item.

I would like the top grid row to link to the details page of the item in the collection when tapped without expanding the third row
Since the first row is inside the expander control. It expands the third row

Im sorry if this is not clear, I can post some code.
0
Victor
Telerik team
answered on 19 Mar 2014, 04:30 PM
Hello Gilberto,

Thanks for writing.
I suspect your expander is being expanded because the text block does not mark the tap gesture as handled.
Since you can not inherit from TextBlock (it is sealed) to make it handle the Tap gesture, you can inherit from Button, override OnTap and mark the gesture as handled. Then you can use your button instead. You also have to style it, so that it looks like a text block. Please have a look at the attached app for a simple example.

Write again if you need further assistance.

Regards,
Victor
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
ExpanderControl
Asked by
Gilbert
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Gilbert
Top achievements
Rank 1
Victor
Telerik team
Share this question
or