AnimatedIndicator Index On Tap

6 posts, 1 answers
  1. Chahine
    Chahine avatar
    4 posts
    Member since:
    Apr 2013

    Posted 02 Sep 2013 Link to this post

    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
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 04 Sep 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Chahine
    Chahine avatar
    4 posts
    Member since:
    Apr 2013

    Posted 07 Sep 2013 Link to this post

    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
  5. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 09 Sep 2013 Link to this post

    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 >>
  6. Chahine
    Chahine avatar
    4 posts
    Member since:
    Apr 2013

    Posted 10 Sep 2013 Link to this post

    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.
  7. Deyan
    Admin
    Deyan avatar
    2037 posts

    Posted 12 Sep 2013 Link to this post

    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 >>
Back to Top
DevCraft banner