Comme je sais, il y a des propriétés qui permettent de faire en sorte que chaque élément de WrapPanel ait la même largeur (ShareSizeScope). Maintenant, je veux archiver la même sortie dans Silverlight, mais il n'y a pas une telle propriété. Y at-il des propriétés ou d'autres moyens qui peuvent m'aider à obtenir la même sortie que dans WPF?Comment définir la largeur de tous les éléments dans WrapPanel à la même valeur?
0
A
Répondre
1
Pour l'instant, il n'y a aucune commande équivalente dans le contrôle pour accomplir ceci. Je ne suis pas sûr de vos besoins, mais si c'était moi, je lierais la largeur de chaque contrôle dans le panneau soit à quelque chose qui a la bonne largeur. Dans cet exemple, j'ai un contrôle d'échantillon sur la page qui a 200 de largeur, puis j'ai réglé tous les enfants WrapPanel pour qu'ils correspondent, quoi que ce soit.
<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>