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

No events from ListBox in ExpandableContent

3 Answers 48 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.
Shantimohan
Top achievements
Rank 1
Shantimohan asked on 01 Jul 2013, 03:10 PM
I created a new page using Telerik's template "Expanding List 05". I wanted to get the SelectedItem from the RadDataboundListBox in the ExpandableContentTemplate. But the Tap or SelectionChanged events are not firing from this list box. Only the out list box is firing the events.

What am I doing wrong? Or how do I get them fired from the inner list box?

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 01 Jul 2013, 03:13 PM
Hello Shantimohan,

Could you please prepare a sample project which reproduces the issue and send it to us for further investigation?

You will have to open a new support ticket in order to be able to attach files.

Thanks for your time!

Regards,
Deyan
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Qua
Top achievements
Rank 1
answered on 25 Dec 2013, 02:50 AM
hi telerik.
i try :
<telerikPrimitives:RadDataBoundListBox x:Name="tenserver" Margin="12,3,12,0" SelectionChanged="tenserver_SelectionChanged">
    <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
        <DataTemplate>
            <telerikPrimitives:RadExpanderControl ExpandableContent="{Binding}" Content="{Binding}" BorderThickness="0, 3, 0, 0" BorderBrush="{StaticResource PhoneSubtleBrush}" Template="{StaticResource CustomAnimatedIndicatorExpanderTemplate}">
                <telerikPrimitives:RadExpanderControl.AnimatedIndicatorContentTemplate>
                    <DataTemplate>
                        <Image Margin="0,0,0,6" Source="Images/ExpanderArrow.png"/>
                    </DataTemplate>
                </telerikPrimitives:RadExpanderControl.AnimatedIndicatorContentTemplate>
                <telerikPrimitives:RadExpanderControl.ContentTemplate>
                    <DataTemplate>
                        <Grid>
                            <TextBlock Margin="1,12,1,20" Text="{Binding Path=server, Converter={StaticResource StringToUpperConverter}}" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeNormal}" FontFamily="Segoe WP" FontWeight="Bold" Foreground="{StaticResource PhoneForegroundBrush}"/>
                        </Grid>
                    </DataTemplate>
                </telerikPrimitives:RadExpanderControl.ContentTemplate>
                <telerikPrimitives:RadExpanderControl.ExpandableContentTemplate>
                    <DataTemplate>
                        <Grid Margin="0,0,0,24">
                            <telerikPrimitives:RadDataBoundListBox x:Name="tapphim"  ItemsSource="{Binding eps}" IsHitTestVisible="False" SelectionChanged="tapphim_SelectionChanged" Tap="tapphim_Tap">
                                <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Margin="37,6">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition/>
                                            </Grid.ColumnDefinitions>
                                            <Image Width="87" Height="87" Source="/Images/FrameThumbnail.png"/>
                                            <StackPanel Grid.Column="1">
                                                <TextBlock Margin="12,20,12,0" Grid.Column="1" Text="{Binding ep_name}" TextWrapping="Wrap" FontFamily="Segoe WP SemiLight" FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{StaticResource PhoneForegroundBrush}"/>
                                                <!--<TextBlock Margin="12,0" Grid.Column="1" Text="{Binding ep_video_url}" TextWrapping="Wrap" Foreground="{StaticResource PhoneForegroundBrush}"/>-->
                                            </StackPanel>
                                        </Grid>
                                    </DataTemplate>
                                </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                            </telerikPrimitives:RadDataBoundListBox>
                        </Grid>
                    </DataTemplate>
                </telerikPrimitives:RadExpanderControl.ExpandableContentTemplate>
            </telerikPrimitives:RadExpanderControl>
        </DataTemplate>
    </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
</telerikPrimitives:RadDataBoundListBox>
I can not get the data in RadDataBoundListBox x:Name="tapphim" with event SelectionChanged="tapphim_SelectionChanged" or Tap="tapphim_Tap"

0
Todor
Telerik team
answered on 30 Dec 2013, 09:28 AM
Hi Qua,

I tested the template and here's the observed (and expected) behavior:

The page contains 1 RadDataBoundListBox. It contains 4 items. Each of them is a RadExpanderControl with 3 items. When you tap on each of the 12 items total, the RadDataBoundListBox's Tap event is fired. The SelectionChanged event on the other hand is fired only when the selection in RadDataBoundListBox is changed. Knowing that it contains only 4 items (the expander controls), you need to tap on an expander control that will change the current selection in order to have the event fired. If you need to get the item that is tapped you can use the following approach:
private void RadDataBoundListBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
    RadDataBoundListBoxItem item = ElementTreeHelper.FindVisualAncestor<RadDataBoundListBoxItem>(e.OriginalSource as DependencyObject);
    DataItemViewModel model = item.Content as DataItemViewModel;
}

Alternatively, you can use the RadDataBoundListBox's ItemTap event:
private void RadDataBoundListBox_ItemTap(object sender, ListBoxItemTapEventArgs e)
{
    DataItemViewModel model = e.Item.Content as DataItemViewModel;
}

I hope this information helps.

Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
ExpanderControl
Asked by
Shantimohan
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Qua
Top achievements
Rank 1
Todor
Telerik team
Share this question
or