views:

22

answers:

1

As I know there are some properties that allow to make every elements in WrapPanel have same width (ShareSizeScope). Now I want to archieve the same output in silverlight but there's no such property. Are there any properties or other ways that can help me to get same output as in WPF?

+1  A: 

At the moment, there is no equivalent command in the control to accomplish this. I'm not sure what your needs are, but if it were me, I'd bind the width of each control in the panel either to something that has the right width. In this example, I have sample control on the page that is 200 in width, then I set all the WrapPanel children to match that, whatever it is.

    <Grid x:Name="LayoutRoot" Background="White">
    <TextBlock x:Name="MyTarget" Text="Hello World" Width="200"/>
    <toolkit:WrapPanel Name="wrapPanel1" Margin="0,30">
        <TextBlock Text="The" Width="{Binding ElementName=MyTarget, Path=Width}" />
        <TextBlock Text="Quick" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="Brown" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="Fox" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="Jumped" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="Over" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="The" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="Lazy" Width="{Binding ElementName=MyTarget, Path=Width}"/>
        <TextBlock Text="Dog" Width="{Binding ElementName=MyTarget, Path=Width}"/>
    </toolkit:WrapPanel>
</Grid>
Todd Davis