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

Binding with HEader Template.

1 Answer 78 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.
Cristovao
Top achievements
Rank 1
Cristovao asked on 21 Mar 2012, 11:15 PM
I have my List like this:

<telerikPrimitives:RadDataBoundListBox  Margin="12,0"
   x:Name="lbMainNews"
                          ItemsSource="{Binding News.News}"
                                    ItemTemplate="{StaticResource NewsItemTemplate}" 
                                    Tap="lbNews_Tap"
                                    telerikCore:InteractionEffectManager.IsInteractionEnabled="True" >
                            <telerikPrimitives:RadDataBoundListBox.ListHeaderTemplate>
                                <DataTemplate>
                                    <Grid Name="GridHeader"
                                      Margin="0,0,0,12" Height="150"
                                       DataContext="{Binding DataContext}" Tap="GridHeader_Tap">
 
                                        <Image Width="430" Margin="0,0,0,0"  Stretch="UniformToFill" >
                                            <Image.Source>
                                                <BitmapImage  CreateOptions="{StaticResource CreateOption}" UriSource="{Binding MainImage.Img}"/>
                                            </Image.Source>
                                        </Image>
                                        <StackPanel VerticalAlignment="Bottom" >
                                            <StackPanel.Background>
                                                <SolidColorBrush Color="{StaticResource PhoneBackgroundColor}" Opacity="0.5"/>
                                            </StackPanel.Background>
                                            <TextBlock TextWrapping="Wrap"  Text="{Binding MainArticle.DatePub}" Foreground="White" Margin="12,0,12,0"  Style="{StaticResource PhoneTextTitle3Style}"/>
                                            <TextBlock TextWrapping="Wrap"  Text="{Binding Title}" Style="{StaticResource PhoneTextTitle3Style}" Foreground="White" Margin="12,0,12,0"/>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </telerikPrimitives:RadDataBoundListBox.ListHeaderTemplate>
 
                            <telerikPrimitives:RadDataBoundListBox.EmptyContentTemplate>
                                <DataTemplate>
                                    <TextBlock Style="{StaticResource PhoneTextLargeStyle}" Text=" "/>
                                </DataTemplate>
                            </telerikPrimitives:RadDataBoundListBox.EmptyContentTemplate>
 
 
                            <telerikPrimitives:RadDataBoundListBox.ListFooterTemplate>
                                <DataTemplate>
                                    <Grid Height="70" Background="Transparent"></Grid>
                                </DataTemplate>
                            </telerikPrimitives:RadDataBoundListBox.ListFooterTemplate>
                        </telerikPrimitives:RadDataBoundListBox>


Now the itemsource is easy and works well

The object has News.News = collection on lines
and also News.MainArticle = object with one Article...

My dificulty is how do I bind the header template

1 Answer, 1 is accepted

Sort by
0
Cristovao
Top achievements
Rank 1
answered on 23 Mar 2012, 10:35 AM
Found the answer... sooo easy!

<telerikPrimitives:RadDataBoundListBox  Margin="0"
                                                       x:Name="lbMainNews"
                                                       ItemsSource="{Binding News.News}"
                               ItemTemplate="{StaticResource NewsItemTemplateInPivot}"
                               ListHeaderTemplate="{StaticResource NewsList_HeaderTemplate}" 
                               ListHeaderContent="{Binding News.MainArticle}"
                               Tap="lbNews_Tap"
                               telerikCore:InteractionEffectManager.IsInteractionEnabled="True" >

just used 

  ListHeaderTemplate="{StaticResource NewsList_HeaderTemplate}"  
  ListHeaderContent="{Binding News.MainArticle}"
Tags
DataBoundListBox
Asked by
Cristovao
Top achievements
Rank 1
Answers by
Cristovao
Top achievements
Rank 1
Share this question
or