views:

100

answers:

1

Hi all, I am using silvelight listbox control,and i stucked.Every listbox item contains another listbox item now when i bind my data second listbox control,it appears horizontal scrollbar and this is not a problem i can remove it.How can do when I add new Item to second listbox,its height automatically increase?

For a second listbox Height=Auto dont work because its scrolling.

is that possible?

Thx.

Here is XAML code:

   <DataTemplate x:Key="VesselListItem">
    <Border  Height="Auto" HorizontalAlignment="Left" Margin="0"  Name="border1" VerticalAlignment="Top" Width="271" CornerRadius="7" BorderThickness="2">
        <Grid  Name="grid1" Width="Auto">
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="6,1,0,0" Name="textBlock1" Text="BOSPOROTUES PIRATES"  VerticalAlignment="Top" FontWeight="Normal" FontSize="14" Width="197" Foreground="#FFF9DD06" >
                    <TextBlock.Effect>
            <DropShadowEffect ShadowDepth="2" BlurRadius="2" Direction="338"/>
        </TextBlock.Effect>
            </TextBlock>
            <Rectangle Canvas.ZIndex="-1"  Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Margin="0,0,0,0" Name="rectangle1" Stroke="Black" StrokeThickness="2" Width="Auto" RadiusX="7" RadiusY="7" Opacity="0.15" Fill="White" />
            <c1ext:C1Expander Height="Auto" HorizontalAlignment="Left" Margin="6,22,5,10" Name="c1Expander1"  VerticalAlignment="Top" Width="255" IsExpanded="True">
                <Grid HorizontalAlignment="Stretch" Name="grid6" VerticalAlignment="Stretch" ShowGridLines="False" Height="50">
                    <ListBox Height="Auto"  HorizontalAlignment="Stretch" Margin="0" Name="listBox1" VerticalAlignment="Stretch" Width="Auto" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                        <ListBoxItem Content="sdfgdsfgdsfg" />
                        <ListBoxItem Content="sdfhsdfhdsfh" />
                        <ListBoxItem Content="sdfhsdfhsdfh" />
                        <ListBoxItem Content="sdfhsdfhsdfh" />
                        <ListBoxItem Content="sdfhdsfhsdfh" />
                        <ListBoxItem Content="sdfhdsfhd" />
                        <ListBoxItem Content="tttttttttt" />
                    </ListBox>
                </Grid>
            </c1ext:C1Expander>
        </Grid>
        <Border.BorderBrush>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="#9FFFFFFF" Offset="0" />
                <GradientStop Color="White" Offset="0.654" />
                <GradientStop Color="#4A408B9D" Offset="0.423" />
                <GradientStop Color="#BA002D76" Offset="1" />
            </LinearGradientBrush>
        </Border.BorderBrush>
    </Border>
</DataTemplate>
A: 

I have a similar issue. I am using data template to show content of each item. The data with in each template can be more or less. However, once I scroll, the height of all the items is changed to the height of the item who is showing maximum data.