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

RadWrapPanel auto height

1 Answer 70 Views
WrapPanel
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stephan
Top achievements
Rank 2
Stephan asked on 12 Jun 2013, 07:44 PM
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




1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 14 Jun 2013, 08:39 AM
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.
Tags
WrapPanel
Asked by
Stephan
Top achievements
Rank 2
Answers by
Victor
Telerik team
Share this question
or