Strange ItemTemplate behaviour

3 posts, 1 answers
  1. Ilija
    Ilija avatar
    8 posts
    Member since:
    Jan 2012

    Posted 02 Nov 2012 Link to this post

    Hi,

    I have some kind of really strange behavior, using the Expander in an ItemTemplate for a RadDataBoundListBox. After expanding the content, there is a line, right under the expander, showing the type that is bound to the ItemsSource of the RadDataBoundListBox.

    Below you can see the DataTemplates I used, and I attached also an image. Thank you for your help.

    <DataTemplate x:Key="LinksExpanderContentTemplate">
               <Grid Background="LightGray">
                   <StackPanel Orientation="Horizontal">
                       <Image x:Name="imgVoteUp"
                              Height="32" VerticalAlignment="Center"
                              Width="32" Source="Images/Road-Forward.png" />
                       <TextBlock x:Name="tbVoteCount"
                                  Text="{Binding Ranking.Votes}"
                                  FontSize="18" Foreground="White" VerticalAlignment="Center"></TextBlock>
                       <Image x:Name="imgVoteDown"
                              Height="32"
                              Width="32" VerticalAlignment="Center"
                              Source="Images/Road-Backward.png" />
                       <StackPanel VerticalAlignment="Center">
                           <TextBlock x:Name="tbLinkTitleHeader"
                                      Text="{Binding Title,Converter={StaticResource titleconv}}"
                                      Foreground="#FF1586EA" />
                           <TextBlock x:Name="tbCreationInformation"
                                      Text="{Binding CreationData}"
                                      FontSize="9" />
                       </StackPanel>
                       </StackPanel>
     
               </Grid>
           </DataTemplate>
           <DataTemplate x:Key="ListExpanderExpandedTemplate">
               <Grid Background="LightGray">
                   
                   <StackPanel VerticalAlignment="Top" HorizontalAlignment="Left">
                       <TextBlock Text="{Binding Title}"
                                  x:Name="linkTitle"
                                  FontSize="11"
                                  TextWrapping="Wrap"
                                  FontWeight="Bold"
                                  Foreground="#FF1586EA"
                                  Margin="0,3,0,0" />
                       <StackPanel Orientation="Horizontal"
                                   Margin="3,0,0,0">
                           <Image Height="16" VerticalAlignment="Center"
                                  Width="16"
                                  Source="Images/geeklisticons/links.png" />
                           <TextBlock Text="{Binding Url}"
                                      VerticalAlignment="Center" x:Name="tbLinkURL"
                                      Margin="3,0,0,0" />
                       </StackPanel>
                       <StackPanel Orientation="Horizontal"
                                   Margin="3,0,0,0">
                           <Image Height="16" VerticalAlignment="Center"
                                  Width="16"
                                  Source="Images/folder.png" />
                           <TextBlock Text="{Binding Category.Name}"
                                      VerticalAlignment="Center" x:Name="tbLinkFolder"
                                      Margin="3,0,0,0" />
                       </StackPanel>
                       <TextBlock Text="{Binding CreationData}"
                                  x:Name="tbPublishTimeSpan"
                                  Margin="0,5,0,0"
                                  FontStyle="Italic" />
                   </StackPanel>
               </Grid>
           </DataTemplate>
           <DataTemplate x:Key="LinksAnimatedIndicatorContent">
               <Grid />
           </DataTemplate>
           <DataTemplate x:Key="LinksItemTemplate">
               <Grid x:Name="outerGrid"
                     >
                   <telerikPrimitives:RadExpanderControl Content="RadExpanderControl"
                                                         x:Name="linkExpander"
                                                         HorizontalAlignment="Stretch"
                                                         VerticalAlignment="Stretch"
                                                         ContentTemplate="{StaticResource LinksExpanderContentTemplate}"
                                                         ExpandedStateContentTemplate="{StaticResource ListExpanderExpandedTemplate}"
                                                         AnimatedIndicatorContentTemplate="{StaticResource LinksAnimatedIndicatorContent}" />
     
               </Grid>
               
                
           </DataTemplate>
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 05 Nov 2012 Link to this post

    Hi Ilija,

    Thanks for contacting us.

    The reason for this behavior is that you are not setting the ExpandableContent/ExpandableContentTemplate properties. The ExpandableContent property is what is displayed when the ExpanderControl is expanded. The ExpandedStateContent is what is visible in the header of the control when it is expanded. You can also overcome this behavior by setting the ExpandableContent property on XAML to {x:Null}.

    Please take a look at our online help for more information on using ExpanderControl:

    http://www.telerik.com/help/windows-phone/radexpandercontrol-gettingstarted.html

    I hope this helps.

    All the best,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Ilija
    Ilija avatar
    8 posts
    Member since:
    Jan 2012

    Posted 05 Nov 2012 Link to this post

    Hi Deyan,

    thank you for your help :)

    Best,
    Ilija
Back to Top