Support of items of different widths?

4 posts, 0 answers
  1. Tony
    Tony avatar
    24 posts
    Member since:
    Nov 2011

    Posted 19 Mar 2012 Link to this post

    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>











  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 19 Mar 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Tony
    Tony avatar
    24 posts
    Member since:
    Nov 2011

    Posted 19 Mar 2012 Link to this post

    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?

  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 20 Mar 2012 Link to this post

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