RadWrapPanel auto height

2 posts, 0 answers
  1. Stephan
    Stephan avatar
    29 posts
    Member since:
    May 2013

    Posted 12 Jun 2013 Link to this post

    Hi,

    I'm trying to have a RadWrapPanel that changes its height depending on the number of items. The reason is that I dynamically add/remove item depending on user actions. I placed the RadWrapPanel along other controls in a Grid with the following attributes.
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="64"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            ...
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            ...
        </Grid.RowDefinitions>
         
        ...
         
        <!-- tags -->
        <TextBlock Margin="10,10,0,0" TextWrapping="NoWrap" Text="Tags" VerticalAlignment="Top" HorizontalAlignment="Left" Foreground="Black" Grid.Column="0" Height="27" Width="422" Grid.ColumnSpan="3" Grid.Row="4"/>
        <telerikPrimitives:RadWrapPanel x:Name="WrapPanelTags" Grid.ColumnSpan="2" VerticalAlignment="Stretch" Grid.Row="5" />
        <Button x:Name="ButtonAddTags" Grid.Column="2" Style="{StaticResource RoundButton}" Grid.Row="5" VerticalAlignment="Top" Height="72" Click="ButtonAddTags_OnClick">
            <Button.Foreground>
                <ImageBrush ImageSource="/Brainchest.TimeStamp.WP;component/Icons/button.add.png" Stretch="Fill"/>
            </Button.Foreground>
        </Button>
     
        ...
    </Grid>


    Doing this with a StackPanel is pretty straight forward as I just need to add the item height programmatically to the current stack panel height. But the advantage of the RadWrapPanel is that I can have multiple items in one line. Thus, my list gets smaller (height wise). But when I add too much items to fit on one line RadWrapPanel wraps the newest item but remains with the current height. Unfortunately, I can't calculate the height because of that reason.

    Any help is highly appreciated

    Kind Regards,
    Stephan




  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 14 Jun 2013 Link to this post

    Hello Stephan,

    Thanks for writing.
    RadWrapPanel does indeed change its height depending on how many items it has. Can you please explain in more detail what you are trying to achieve? Adding 100 tags makes the wrap panel 1200 pixels high.

    Regards,
    Victor
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top