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

horizontal stretch with templateselector

1 Answer 24 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 15 Jan 2013, 12:59 PM
I have a strange issue ... when I do this:

<telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                          <DataTemplate>
 
 
                              <Grid   Background="{Binding BackgroundResource, Converter={StaticResource ColorToBrushConverter}}" Height="96" Margin="12">
                                  <Grid.ColumnDefinitions>
                                      <ColumnDefinition Width="96"></ColumnDefinition>
                                      <ColumnDefinition ></ColumnDefinition>
                                  </Grid.ColumnDefinitions>
                                  <Image Source="{Binding BackgroundResource, Converter={StaticResource IconConverter}}" Width="48" Height="48"></Image>
                                  <TextBlock Text="{Binding Title}" Grid.Column="1" Style="{StaticResource PhoneTextNormalStyle}" VerticalAlignment="Center"/>
                              </Grid>
                          </DataTemplate>
                      </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                      <telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
                          <Style TargetType="telerikPrimitives:RadDataBoundListBoxItem">
                              <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                          </Style>
                      </telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
                  </telerikPrimitives:RadDataBoundListBox>


the line stretchs...

yet doing this 

<telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                         <DataTemplate>
                             <code:MainMenuTemplateSelector Content="{Binding}">
                                 <code:MainMenuTemplateSelector.Area>
                                     <DataTemplate>
                                         <Grid   Background="{Binding BackgroundResource, Converter={StaticResource ColorToBrushConverter}}" Height="96" Margin="12">
                                             <Grid.ColumnDefinitions>
                                                 <ColumnDefinition Width="96"></ColumnDefinition>
                                                 <ColumnDefinition ></ColumnDefinition>
                                             </Grid.ColumnDefinitions>
                                             <Image Source="{Binding BackgroundResource, Converter={StaticResource IconConverter}}" Width="48" Height="48"></Image>
                                             <TextBlock Text="{Binding Title}" Grid.Column="1" Style="{StaticResource PhoneTextNormalStyle}" VerticalAlignment="Center"/>
                                         </Grid>
                                     </DataTemplate>
                                 </code:MainMenuTemplateSelector.Area>
                                 <code:MainMenuTemplateSelector.Family>
                                     <DataTemplate>
                                         <Border BorderThickness="2" BorderBrush="{Binding BackgroundResource, Converter={StaticResource ColorToBrushConverter}}" Height="96" Margin="12">
                                             <TextBlock Foreground="{Binding BackgroundResource, Converter={StaticResource ColorToBrushConverter}}" Text="{Binding Title}" Grid.Column="1" Style="{StaticResource PhoneTextNormalStyle}" VerticalAlignment="Center"/>
                                         </Border>
 
                                     </DataTemplate>
                                 </code:MainMenuTemplateSelector.Family>
                                 <code:MainMenuTemplateSelector.SubFamily>
                                     <DataTemplate>
                                         <Grid Background="{Binding BackgroundResource, Converter={StaticResource ColorToBrushConverter}}" Height="96" Margin="12">
                                             <TextBlock Text="{Binding Title}" Grid.Column="1" Style="{StaticResource PhoneTextNormalStyle}" VerticalAlignment="Center"/>
                                         </Grid>
                                     </DataTemplate>
                                 </code:MainMenuTemplateSelector.SubFamily>
                             </code:MainMenuTemplateSelector>
                         </DataTemplate>
                     </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                     <telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
                         <Style TargetType="telerikPrimitives:RadDataBoundListBoxItem">
                             <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                         </Style>
                     </telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
                 </telerikPrimitives:RadDataBoundListBox>

it doesnt ...
strange isn't ?

1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 16 Jan 2013, 09:31 AM
Hello Cristovao,

Thanks for writing.

I am not quite sure that I correctly understand the case.

Can you please provide me with some further details like screenshots or steps to reproduce the case so that I can make sure that I correctly understand it?

It will be great if you manage to attach a sample project that reproduces the issue as well.

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