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

Support of items of different widths?

3 Answers 146 Views
VirtualizingWrapPanel
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 19 Mar 2012, 02:01 PM
Does the VirtualizingWrapPanel support items of different widths?

For example, I have a list box which contains a list of Tile. I use a DataTemplateSelector  to look at a property on a tile to select the DataTemplate to render the Tile with. Depending on the tile type, the width will be a different size. Is this possible with this wrap panel?

Relevant Snippets of code Im use:
<ListBox x:Name="lstStaticNavOptions" ItemsSource="{Binding StartTileList}"
                             Background="Transparent" BorderThickness="0"
                             ScrollViewer.VerticalScrollBarVisibility="Disabled"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                             HorizontalContentAlignment="Stretch"
                             Style="{StaticResource TileListBoxStyle}"
                             ItemTemplate="{StaticResource dtTileChooser}" >

<DataTemplate x:Key="dtTileChooser">
    <templates:TileTemplateSelector Content="{Binding}" >
        <templates:TileTemplateSelector.RefreshTrainingStatusTemplate>
            <DataTemplate>
                <Grid Margin="2 0" Width="120" Height="120" Background="Red">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Text="{Binding TileStatus}"  Grid.Row="1"  VerticalAlignment="Top" TextAlignment="Center" TextWrapping="Wrap"/>
                </Grid>
            </DataTemplate>
        </templates:TileTemplateSelector.RefreshTrainingStatusTemplate>
        <templates:TileTemplateSelector.MyDocumentsStatusTemplate>
            <DataTemplate>
                <Grid Margin="2 0" Width="250" Height="120" Background="#FF169FDC">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Text="{Binding TileStatus}"  Grid.Row="1"  VerticalAlignment="Top" TextAlignment="Center" TextWrapping="Wrap"/>
                </Grid>
            </DataTemplate>
        </templates:TileTemplateSelector.MyDocumentsStatusTemplate>
    </templates:TileTemplateSelector>
</DataTemplate>

<Style x:Key="TileListBoxStyle" TargetType="ListBox" >
    <Setter Property="Padding" Value="0" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
    <Setter Property="ItemsPanel">
        <Setter.Value>
            <ItemsPanelTemplate>
                <telerik:VirtualizingWrapPanel Orientation="Horizontal" ItemHeight="120" ItemWidth="120" />
            </ItemsPanelTemplate>
        </Setter.Value>
    </Setter>
</Style>











3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 19 Mar 2012, 02:23 PM
Hello,

I'm afraid that such scenario is not supported. 

All the best,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Tony
Top achievements
Rank 1
answered on 19 Mar 2012, 02:27 PM
Ok... thanks.. I'll use the Silverlight Toolkit WrapPanel instead. Is there any thoughts to adding this feature in the future? Would the older RadWrapPanel be an option?

0
Vlad
Telerik team
answered on 20 Mar 2012, 08:09 AM
Hi,

 I'm not sure if these will work for you since they are no virtual - you will get performance and memory problems in case of many items. 

Greetings,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
VirtualizingWrapPanel
Asked by
Tony
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Tony
Top achievements
Rank 1
Share this question
or