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

AnimatedIndicator Index On Tap

5 Answers 53 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chahine
Top achievements
Rank 1
Chahine asked on 02 Sep 2013, 06:38 PM
Hi,

I'm trying go get the index of the ContentTemplate but works only for the 'RadExpanderControl.ContentTemplate' but not the 'RadExpanderControl.AnimatedIndicatorContentTemplate'

Here is my xaml : 

<telerikPrimitives:RadDataBoundListBox>
  <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>
            <Rectangle Width="40" Height="40" Fill="{StaticResource AccentColor}" Tap="Rectangle_Tap" Tag="{Binding index}">
              <Rectangle.OpacityMask>
                <ImageBrush ImageSource="Images/ExpanderArrow.png"/>
              </Rectangle.OpacityMask>
            </Rectangle>
          </DataTemplate>
        </telerikPrimitives:RadExpanderControl.AnimatedIndicatorContentTemplate>
        <telerikPrimitives:RadExpanderControl.ContentTemplate>
          <DataTemplate>
            <Grid Tap="Grid_Tap" Tag="{Binding index}">
              <TextBlock Margin="1,12,1,20" Text="{Binding index, StringFormat='INDEX\{0\}'}"/>
            </Grid>
          </DataTemplate>
        </telerikPrimitives:RadExpanderControl.ContentTemplate>
        <telerikPrimitives:RadExpanderControl.ExpandableContentTemplate>
          <DataTemplate>
            ...
          </DataTemplate>
        </telerikPrimitives:RadExpanderControl.ExpandableContentTemplate>
      </telerikPrimitives:RadExpanderControl>
    </DataTemplate>
  </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
</telerikPrimitives:RadDataBoundListBox>

and my .cs

private void Grid_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
   var i = (sender as Grid).Tag; // value is correct
}
 
private void Rectangle_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
   var i = (sender as Rectangle).Tag; // value always equal to null
}

Regards,
Chahine

5 Answers, 1 is accepted

Sort by
0
Accepted
Deyan
Telerik team
answered on 04 Sep 2013, 03:20 PM
Hi Chahine,

Thanks for writing.

Based on the XAML snippet I think the issue comes from the fact that you have missed binding the AnimatedIndicatorContent to the data context of the parent item just like the ExpandableContent and the Content properties are bound to it. Check out if binding this property will resolve the issue and let me know if you need further assistance with this.

Regards,
Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Chahine
Top achievements
Rank 1
answered on 07 Sep 2013, 05:52 PM
Thank you Deyan, now it works fine.

And how can I detect a tap event in my ExpandableContentTemplate ?

<telerikPrimitives:RadExpanderControl.ExpandableContentTemplate>
  <DataTemplate>
    <Grid Margin="0,0,12,24">
      <telerikPrimitives:RadDataBoundListBox ItemsSource="{Binding items}" IsHitTestVisible="False">
         <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
           <DataTemplate>
                  <Grid/>
           </DataTemplate>
         </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
      </telerikPrimitives:RadDataBoundListBox>
    </Grid>
  </DataTemplate>
 </telerikPrimitives:RadExpanderControl.ExpandableContentTemplate>

Regards, 
Chahine
0
Deyan
Telerik team
answered on 09 Sep 2013, 03:16 PM
Hi Chahine,

You can simply subscribe for the ItemTap event exposed by RadDataBoundListBox.

I hope this helps.

Regards,
Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Chahine
Top achievements
Rank 1
answered on 10 Sep 2013, 05:39 PM
But the problem is that I've set the IsHitTestVisible property to false so that the RadDataBoundListBox
in my ExpandableContent won't mess things up with the main RadDataBoundListBox.
0
Deyan
Telerik team
answered on 12 Sep 2013, 12:19 PM
Hi Chahine,

Thanks for writing back.

Can you please try setting the IsHitTestVisible to the rootmost element in your ItemTemplate for the internal list box and handle the Tap event of the internal list box itself which you should make hit test visible?

Regards,
Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
DataBoundListBox
Asked by
Chahine
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Chahine
Top achievements
Rank 1
Share this question
or